Integration with Azure DevOps CI/CD Pipelines

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

Prerequisites

  • Integrate The Azure DevOps repository with to push or pull feature files.

  • Host the source code on the Azure DevOps repository.

  • Create the azure-pipelines.yml file in the Repository Files in Azure DevOps.

Set up the Azure DevOps Pipeline

To set up the Azure DevOps pipeline that executes an automated tests project and sends the results to , perform the following steps:

  1. 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.

  2. Download the sample file.

  3. Define the Parameters.

    You can define the parameters for QMetry Automation API in the azure-pipelines.yml file. There are two ways to define the variables:

    • Variables can be defined in the script itself as shown below.

      Define_variables.png
    • The variables can be added at run time while running the Pipeline and can be used dynamically.

      Variables_dnyamically.png

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

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

Azure_Pipelines.png

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.

Test_Result_Files.png

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.

    Migration_Script.png

How To Migrate Test Results?

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

  • Through Source Code

  • Using the Test Result Files

Migrate Test Results through Source Code

  1. 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.

    Build_the_Project.png
  2. Copy the test result file name from the pipeline as displayed below.

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

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

    Azure_Pipelines1.png

Migrate Test Results using the Test Result Files

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

    azure-pipelines.png
  2. Then run the pipeline with the variables and CmdLine@2 Task as shown below.

    run_the_pipeline.png

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 Run.

    Run_Pipeline2.png

    You can change the variable values at run time.

  2. Click Run.

    Run.png

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

    Queued.png
    Migration_Script1.png

    The job is completed successfully.

    Success.png

Verify the Progress in

You can view the progress of the automation result upload .

Progress.png

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

Publication date: