Our documentation site has been updated to AIO Tests Knowledge Base

Bitbucket

Bitbucket is a Git-based source code repository hosting service owned by Atlassian. It also offers the ability to build, test and deploy code through it’s integrated CI/CD service, Bitbucket Pipelines.

AIO Tests, today, doesn’t provide a native support for Bitbucket, but the results from supporting frameworks can still be uploaded using AIO Tests REST APIs.

AIO Tests supports Junit and TestNG xmls and also supports the Cucumber json reports.

Example

The example is based on a Cucumber + Java + Maven based project.

Workflow

  1. The tests are executed by the mvn test command.

  2. The command runs the suite file and produces the cucumber.json report in the target folder.

  3. When the mvn command finishes execution, the next steps is to curl the results to AIO Tests.

Bitbucket pipeline

  1. If there is no existing bitbucket-pipelines.yml in the project, click on Pipelines in the Bitbucket left panel and Create Your first pipeline

  2. Depending on your framework, select the starter pipeline. For this example, Maven starter was chosen.

  3. Sample simple pipeline would look like below:

    image: maven:3.6.3 pipelines: default: - parallel: - step: name: Build and Test caches: - maven script: - | echo 'Running tests' mvn -DtestFailureIgnore=true test curl -H "accept:application/json" -H "Authorization:AioAuth $AIO_AUTH" -H "Content-Type:multipart/form-data" -F "createNewRun=true" -F "addCaseToCycle=true" -F "createCase=true" -F "bddForceUpdateCase=true" -F "file=@target/cucumber-reports/Cucumber_TempTracker.json;type=application/json" -X POST "https://tcms.aiojiraapps.com/aio-tcms/api/v1/project/$JIRA_PROJ/testcycle/$AIO_CYCLE/import/results?type=Cucumber" echo 'Done'

     

  4. Add Variables. In the below example, we have parametrized the Authorization token, the Jira project and the Cycle which needs to be updated

     

  5. Run the pipeline. The pipeline will run and at the end of the run, the cucumber.json file will be posted to AIO Tests for marking results.

Decoding the Curl command

The curl command used reads the environment variables and sets the properties available for configuration in the Import Results API exposed by AIO Tests.

  • createNewRun - Creates a new run for each case

  • addCaseToCycle - If case is not already existing in the cycle, then the case is added to the cycle. False will mark such a case in failures

  • createCase - If a key or automation key is not found in the tags, then a new case will be created if set to true.

  • bddForceUpdateCase - (only applicable for Cucumber) If the automation results file has different steps then the mapped case in AIO Tests, then they would be overwritten with the one from the results file if the value is set to true.

In our example, we have used framework as Cucumber, however, it should change based on the framework being used.

curl -H "accept:application/json" -H "Authorization:AioAuth $AIO_AUTH" -H "Content-Type:multipart/form-data" -F "createNewRun=true" -F "addCaseToCycle=true" -F "createCase=true" -F "bddForceUpdateCase=true" -F "file=@target/cucumber-reports/Cucumber_TempTracker.json;type=application/json" -X POST "https://tcms.aiojiraapps.com/aio-tcms/api/v1/project/$JIRA_PROJ/testcycle/$AIO_CYCLE/import/results?type=Cucumber"

 

Related Articles

  1. Learn how to generate your authentication token : https://aioreports.atlassian.net/wiki/spaces/NAT/pages/1900879117

  2. AIO Tests Public APIs: https://aioreports.atlassian.net/wiki/spaces/NAT/pages/1900879242