Use CircleCI version 2.1 at the top of your .circleci/config.yml file.
1
version: 2.1Add the orbs stanza below your version, invoking the orb:
1
2
orbs:
firecracker: practitest/firecracker@1.0.1Use firecracker elements in your existing workflows and jobs.
Opt-in to use of uncertified orbs on your organization’s Security settings page.
Regular run of firecracker that will, run ruby tests and upload the results to Practitest via Firecracker. !!!important!!! In case you don't run your circleci as machine user you will need to add these lines as a step: - setup_remote_docker: version: 19.03.13 before you run your tests (in case they fail). In case you use EU environment you will need to change api_uri into https://eu1-prod.practitest.app/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
version: '2.1'
orbs:
firecracker: practitest/firecracker@1.0.0
jobs:
build:
docker:
- image: circleci/ruby:2.5.5-node
steps:
- setup_remote_docker:
version: 19.03.13
- run_test:
command: run test
- store_test_results:
path: test_results
- firecracker/fire:
api_token: FIRE_API_TOKEN
author_id: ${FIRE_AUTHOR}
email: ${FIRE_EMAIL}
firecracker_version: v2.0.3
project_id: ${FIRE_PROJECT_ID}
test_folder: test_results
workflows:
my-workflow:
jobs:
- build:
context:
- PT API Token
This command will get all the configurations for firecracker run and execute it. Firecracker -is a tool to create Testset, Test and Steps in PractiTest from XML test results.
| PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
|---|---|---|---|---|
additional_test_fields add here test fields mapping | add here test fields mapping | No | |
\"custom-fields\":{},\"system-fields\":{} type: string | string |
additional_testset_fields add here Testset field mapping | add here Testset field mapping | No | |
\"custom-fields\":{},\"system-fields\":{} type: string | string |
api_token your PAT (personal api token) or your account's api token in Practitest | your PAT (personal api token) or your account's api token in Practitest | No | FIRE_API_TOKEN type: env_var_name | env_var_name |
api_uri in case you use eu server of practitest you will need to change it into https://eu1-prod.practitest.app | in case you use eu server of practitest you will need to change it into https://eu1-prod.practitest.app | No | https://api.practitest.com type: string | string |
author_id user id who will run firecracker (should depend on api token that you use) Required | user id who will run firecracker (should depend on api token that you use) | Yes | - type: integer | integer |
email email of the user that will run firecracker Required | email of the user that will run firecracker | Yes | - type: string | string |
extra_params in case you want to add extra params to json configuration | in case you want to add extra params to json configuration | No | '' type: string | string |
firecracker_version firecracker version to use Required | firecracker version to use | Yes | - type: string | string |
multitestset decide if firecracker will create multiple testset or single testset | decide if firecracker will create multiple testset or single testset | No | false type: boolean | boolean |
project_id project id that firecracker will direct the results to Required | project id that firecracker will direct the results to | Yes | - type: integer | integer |
step_name map steps name | map steps name | No | |
?pt-test-step-name type: string | string |
test_case_as_pt_test_step decide if firecracker will use test-case as practitest steps or tests; true will group testcases into one test and each testcase will be a step | decide if firecracker will use test-case as practitest steps or tests; true will group testcases into one test and each testcase will be a step | No | true type: boolean | boolean |
test_folder folder that contains test results Required | folder that contains test results | Yes | - type: string | string |
test_name map tests name | map tests name | No | |
?pt-test-name type: string | string |
testset_name in case of single testset creation choose the name for this testset name | in case of single testset creation choose the name for this testset name | No | FirecrackerTestSet type: string | string |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# This code is licensed from CircleCI to the user under the MIT license.
# See here for details: https://circleci.com/developer/orbs/licensing
version: 2.1
description: |
This orb will help you to connect PractiTest's Firecracker tool. Firecracker will use your test result XML and upload it into your PractiTest project.
display:
home_url: https://www.practitest.com/help/methodology-tips/firecracker/
source_url: https://github.com/PractiTest/firecracker-orb
commands:
fire:
description: |
This command will get all the configurations for firecracker run
and execute it.
Firecracker -is a tool to create Testset, Test and Steps in PractiTest
from XML test results.
parameters:
additional_test_fields:
default: |
\"custom-fields\":{},\"system-fields\":{}
description: add here test fields mapping
type: string
additional_testset_fields:
default: |
\"custom-fields\":{},\"system-fields\":{}
description: add here Testset field mapping
type: string
api_token:
default: FIRE_API_TOKEN
description: your PAT (personal api token) or your account's api token in Practitest
type: env_var_name
api_uri:
default: https://api.practitest.com
description: in case you use eu server of practitest you will need to change it into https://eu1-prod.practitest.app
type: string
author_id:
description: user id who will run firecracker (should depend on api token that you use)
type: integer
email:
description: email of the user that will run firecracker
type: string
extra_params:
default: ""
description: in case you want to add extra params to json configuration
type: string
firecracker_version:
description: firecracker version to use
type: string
multitestset:
default: false
description: decide if firecracker will create multiple testset or single testset
type: boolean
project_id:
description: project id that firecracker will direct the results to
type: integer
step_name:
default: |
?pt-test-step-name
description: map steps name
type: string
test_case_as_pt_test_step:
default: true
description: decide if firecracker will use test-case as practitest steps or tests; true will group testcases into one test and each testcase will be a step
type: boolean
test_folder:
description: folder that contains test results
type: string
test_name:
default: |
?pt-test-name
description: map tests name
type: string
testset_name:
default: FirecrackerTestSet
description: in case of single testset creation choose the name for this testset name
type: string
steps:
- run:
command: |
echo "{\"api-token\":\"${<<parameters.api_token>>}\",\"email\":\"<<parameters.email>>\",\"project-id\":<<parameters.project_id>>,\"additional-test-fields\":{<<parameters.additional_test_fields>>},\"additional-testset-fields\":{<<parameters.additional_testset_fields>>},\"multitestset\":<<parameters.multitestset>>,\"test-case-as-pt-test-step\":<<parameters.test_case_as_pt_test_step>>,\"testset-name\":\"<<parameters.testset_name>>\",\"pt-test-name\":\"<<parameters.test_name>>\",\"pt-test-step-name\":\"<<parameters.step_name>>\"}" > config.json
wget https://github.com/PractiTest/practitest-firecracker/releases/download/<<parameters.firecracker_version>>/practitest-firecracker-standalone.jar
docker create -v /app --name firecracker adoptopenjdk:11-jre-hotspot
docker cp "$(pwd)"/<<parameters.test_folder>> firecracker:/app
docker cp "$(pwd)"/config.json firecracker:/app
docker cp "$(pwd)"/practitest-firecracker-standalone.jar firecracker:/app
name: prepare data and download firecracker for
when: always
- run:
command: |
docker run --volumes-from firecracker adoptopenjdk:11-jre-hotspot java --illegal-access=deny -jar /app/practitest-firecracker-standalone.jar --reports-path="app/<<parameters.test_folder>>" --api-uri=<<parameters.api_uri>> --author-id="<<parameters.author_id>>" --config-path="app/config.json" <<parameters.extra_params>> create-and-populate-testset
name: start firecracker
when: always
examples:
simple_run:
description: |
Regular run of firecracker that will, run ruby tests and upload the results to Practitest via Firecracker.
!!!important!!!
In case you don't run your circleci as machine user you will need to add these lines as a step:
- setup_remote_docker:
version: 19.03.13
before you run your tests (in case they fail).
In case you use EU environment you will need to change api_uri into https://eu1-prod.practitest.app/
usage:
version: "2.1"
orbs:
firecracker: practitest/firecracker@1.0.0
jobs:
build:
docker:
- image: circleci/ruby:2.5.5-node
steps:
- setup_remote_docker:
version: 19.03.13
- run_test:
command: run test
- store_test_results:
path: test_results
- firecracker/fire:
api_token: FIRE_API_TOKEN
author_id: ${FIRE_AUTHOR}
email: ${FIRE_EMAIL}
firecracker_version: v2.0.3
project_id: ${FIRE_PROJECT_ID}
test_folder: test_results
workflows:
my-workflow:
jobs:
- build:
context:
- PT API Token