Integration with Azure DevOps CI/CD Pipelines

QMetry enables users to publish the automation execution results achieved through Azure DevOps CI/CD pipelines to QMetry via script.

Prerequisites

  • The Azure DevOps repository should have been integrated with QMetry to push/pull feature files.

  • The source code should have been hosted on the Azure DevOps repository.

  • The azure-pipelines.yml file should have been created in Repository > Files in Azure DevOps.

Set up the Azure DevOps Pipeline

Steps to set up the Azure DevOps pipeline that executes an automated tests project and sends the results to QMetry.

Create the GitLab configuration file azure-pipelines.yml in the root of your project. It contains the definition of the build steps, including running the automated tests and submitting the results.

Download the sample file:

Define Parameters

The parameters used for QMetry Automation API can be defined in the azure-pipelines.yml file.

There are two ways to define variables.

(A) Variables can be defined in the script itself as shown below.

(B) The variables can be added at run time while running the Pipeline and can be used dynamically.

 

Azure Pipeline YAML Configuration

→ Using Body Parameters in azure-pipelines.yml

The parameters and their corresponding Azure variables that can be used dynamically in the cURL request for the pipeline.

Parameters

Azure DevOps Variables

Parameters

Azure DevOps Variables

entityType

ENTITY_TYPE

projectID

PROJECT_ID

releaseID

RELEASE_ID

cycleID

CYCLE_ID

buildID

BUILD_ID

platformID

PLATFORM

testsuiteName

TEST_SUIT_NAME

testsuiteId

TS_ID

tsFolderPath

TS_FOLDER_PATH

skipWarning

`SKIP_WARNING

is_matching_required

IS_MATCHING_REQUIRED

automationHierarchy

AUTOMATION_HIERARCHY

testcase_fields

TC_FIELDS

testsuite_fields

TS_FIELDS

 

→ Build Project

  • Build the project using Maven@3 Task.

Note: Task can differ based on the Project. For example, Maven@3 Task is used for Java Project.

  • Once the build is completed, all the generated files get stored in the directory $(system.defaultworkingdirectory)

  • The $(system.defaultworkingdirectory) directory represents the path _/home/vsts/work/1/s/_

 

→ Test Result Files

  • Use CopyFiles@2 Task to copy generated files from one source to another. The only purpose of this task is to get the test result file name as shown below.

 

→ Migration Script

  • Use CmdLine@2 Azure Task to write the migration script.

  • Finally, the cURL request migrates the test result file to the QMetry Platform.

  • Here, We have used dynamic Parameters which are defined in the Parameters section.

How To Migrate Test Results?

There are two ways to migrate test result files from Azure DevOps to QMetry.

(A) Through Source Code

(B) Using the Test Result Files

(A) Migrate Test Results through Source Code

Step 1. First, Build the Project, which produces the Test Result Files.

For example, to build the Java Project, use Maven@3 Task and comment Migration Script i.e. CmdLine@2 Task as shown below.

Step 2. Then copy the test result file name from the pipeline as displayed below.

Step 3. Add the Test Result File Name inside the script under Variables. 

Step 4. Then uncomment the Migration Script which was commented on in Step 1 above. Then run the pipeline again.  

(B) Migrate Test Results using the Test Result Files

Step 1. Upload the test result file in the Azure repository along with the azure-pipelines.yml file.

Step 2. Then run the pipeline with the variables and CmdLine@2 Task as shown below.

Run Pipeline

You can go ahead and initiate the pipeline once all the required parameters are defined and the configuration is done.

1. Go to Pipelines and click on the Run button.

You can change the variable values at run time.

2. Click on the Run button.

The pipeline job is initiated. The Status of the job is displayed as “Queued”.

The job is completed successfully.

Verify the Progress in QMetry

In QMetry, you can view the progress of the automation result upload to QMetry.

Once the process of uploading the automation test results is over, the test cases and test suites are created in QMetry.