To upload Cucumber test results from Bitbucket Pipelines, you can use the following curl command to do so:
curl -L -X PUT https://test-reports.behave.pro/REST/1.0/bdd/report \
-H "X-API-KEY: $BEHAVE_PRO_API_KEY" \
-H "X-COMMIT-ID: $BITBUCKET_COMMIT" \
-H "X-BUILD-ID: $BITBUCKET_BUILD_NUMBER" \
-H "X-BUILD-URL: https://bitbucket.org/$BITBUCKET_REPO_FULL_NAME/addon/pipelines/home#!/results/$BITBUCKET_BUILD_NUMBER" \
--data-binary @./target/cucumber-reports/cucumber.json
Note: Make sure your tool to send the test report follows the http 307 redirects. When using curl this can be done via -L
option.
Note: For X-COMMIT-ID
please make sure you use the long version of the commit SHA.
Note: If you are using Jira Server or Jira Data Center, the URL to upload the test results is the domain name of your Jira followed by /rest/behavepro/1.0/bdd
For example: https://jira.example.com/rest/behavepro/1.0/bdd
You have to create an environment variable called BEHAVE_PRO_API_KEY
with value of API key. If you don't have one, you can create one by following this article: Publishing Cucumber Test results
If you are using a matrix build you have to provide X-PARAM
header in the http request as shown below:
curl -L -X PUT https://test-reports.behave.pro/REST/1.0/bdd/report \
-H "X-API-KEY: $BEHAVE_PRO_API_KEY" \
-H "X-COMMIT-ID: $BITBUCKET_COMMIT" \
-H "X-BUILD-ID: $BITBUCKET_BUILD_NUMBER" \
-H "X-BUILD-URL: https://bitbucket.org/$BITBUCKET_REPO_FULL_NAME/addon/pipelines/home#!/results/$BITBUCKET_BUILD_NUMBER" \
-H "X-PARAM: Os=Linux" \
-H "X-PARAM: JVM=Java 1.8" \
--data-binary @./target/cucumber-reports/cucumber.json
if you want to learn more about matrix build and living documentation you can read this article: Publishing Cucumber test results from Matrix jobs.