Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Current »

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 its integrated CI/CD service, Bitbucket Pipelines.

AIO Tests, today, doesn’t provide 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.

In this documentation, you’ll understand:

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 step 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, a 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 the 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"
  1. Learn how to generate your authentication token: Rest API Authentication

  2. AIO Tests Public APIs: REST APIs

For further queries and suggestions, please feel free to reach out to our customer support service via help@aiotests.com.

  • No labels