Page History
...
Code Block | ||||
---|---|---|---|---|
| ||||
image: "ruby:2.36" test: script: - | apt-get update -qq apt-get install unzip gem install cucumber gem install rspec-expectations export token=$(curl -H "Content-Type: application/json" -X POST --data "{ \"client_id\": \"$client_id\",\"client_secret\": \"$client_secret\" }" https://xray.cloud.xpand-it.com/api/v1/authenticate| tr -d '"') curl -H "Content-Type: application/json" --output features/features.zip -X GET -H "Authorization: Bearer ${token}" "https://xray.cloud.xpand-it.com/api/v1/export/cucumber?keys=$cucumber_keys" mkdir -p features rm -f features/*.feature unzip -o features/features.zip -d features/ cucumber -x -f json -o data.json curl -H "Content-Type: application/json" -X POST -H "Authorization: Bearer ${token}" --data @data.json https://xray.cloud.xpand-it.com/api/v1/import/execution/cucumber echo "done" |
...
In this example, we're using a variable cucumber_keys defined in the CI/CD project-level settings in GitLab. This variable contains one or more keys of the issues that will be used as source data for generating the Cucumber .feature files; it can be the key(s) of Test Plan(s), Test Execution(s), Test(s), requirement(s). For more info, please see: Exporting Cucumber Tests - REST.
...
The GitLab configuration file .gitlab-ci.ym
l contains the definition of the build steps, including synchronizing the Scenarios/Backgrounds to Xray, extracting the cucumber specification from Xray, running the automated tests and submitting back the results.
.gitlab-ci.yml
- | apt-get update -qq apt-get -y install zip unzip gem install cucumber gem install rspec-expectations export token=$(curl -H "Content-Type: application/json" -X POST --data "{ \"client_id\": \"$client_id\",\"client_secret\": \"$client_secret\" }" https://xray.cloud.xpand-it.com/api/v1/authenticate| tr -d '"') cd features; zip -R features.zip "*.feature"; cd ..; curl -H "Content-Type: multipart/form-data" -H "Authorization: Bearer ${token}" -F "file=@features/features.zip" "https://xray.cloud.xpand-it.com/api/v1/import/feature?projectKey=CALC" rm -f features/*.feature curl -H "Content-Type: application/json" --output features/features.zip -X GET -H "Authorization: Bearer ${token}" "https://xray.cloud.xpand-it.com/api/v1/export/cucumber?filter=$filter_id" unzip -o features/features.zip -d features/ cucumber -x -f json -o data.json || true curl -H "Content-Type: application/json" -X POST -H "Authorization: Bearer ${token}" --data @data.json https://xray.cloud.xpand-it.com/api/v1/import/execution/cucumber echo "done" |
...
In this example, we're using a variable filter_id defined in the CI/CD project level settings in GitLab. This variable contains the id of the Jira issues based filterhat based filter that will be used as source data for generating the Cucumber .feature files; it can be the key(s) of Test Plan(s), Test Execution(s), Test(s), requirement(s). For more info, please see: Exporting Cucumber Tests - REST.
...