Integrate TestGrid with Azure Pipelines

You are here:
< All Topics

Overview

Azure DevOps offers the Azure Pipelines service, which enables projects to ship more quickly by utilizing a dependable pipeline. Using Azure Pipelines, you can quickly create a build and test it before publishing the changes live in any language you are comfortable with, including Node.js, Python, Java, PHP, Ruby, C/C++,.NET, and more. The platform provides open-source applications with unlimited CI/CD minutes and ten free parallel jobs. Azure pipelines are cross-platform friendly, allowing you to run jobs in parallel on Windows, macOS, and Linux.

Pre-requisite

  • A GitHub account where you can create a repository
  • An Azure DevOps organization If your team already has one, then make sure you’re an administrator of the Azure DevOps project that you want to use.
  • An ability to run pipelines on Microsoft-hosted agents. To use Microsoft-hosted agents, your Azure DevOps organization must have access to Microsoft-hosted parallel jobs. You can either purchase a parallel job or request a free grant.

Integrating TestGrid with Azure Pipelines

Step 1: Sign in to your Azure DevOps organization and go to your project.

  • We need to develop a project. Fill in the appropriate fields and click the Create button.

 

 

Step 2: Once you create a project, Go to Pipelines and Click on New Pipeline.

 

 

The Create New Pipeline window will appear after you click the pipeline, so click Create Pipeline there.

 

 

Step 3: Follow the steps of the wizard by first selecting GitHub as the location of your source code.

 

 

Step 4: Once you click on GitHub, the Azure OAuth window will appear.

  • Select the account from which you want to create a pipeline.
  • Then select the Authorized Azure Pipeline option.

 

 

After you click Authorize Azure Pipeline, a confirmation window will appear. Enter your valid password in the required field and click the Confirm button.

 

 

Step 5: The list of repositories window will appear after you click the confirm button; choose your repository.

 

 

 

Step 6: You might be redirected to GitHub to install the Azure Pipelines app. If so, select Approve & Install.

 

 

 

You will see a window asking you to confirm your account once you have clicked on “approve and install.” Select your account from the list.

 

 

Step 7: After selecting your account, you will be directed to the Azure DevOps dashboard.

  • A list of configured pipelines will appear once you choose the configure option.
  • From that list, choose the pipeline you have already configured. If you don’t have an existing YAML file you can select Starter pipeline.
  • Once you proceed, you will have a YAML file that you can edit, Now to integrate TestGrid test case execution, we need to call TestGrid API using the curl command in this YAML file.

 

 

Step 8: Log into your TestGrid account using your valid credentials to get API parameters for Testcase.

  • Select the TestCsae writer from the TestGrid dashboard, then select any of the applications.
  • When you click on the version, you will see the ‘i’ button on the right top corner of the screen. The continuous integration document window appears when you click the ‘i’ icon.

 

 

You can then copy the required parameters and use them in the YAML file in the curl command.

 

 

 

 

Here are the curl command syntax for different platforms

Selenium Web Syntax:

curl --location 'https://{your_domain}.testgrid.io/ci/app_build_run' \
--form 'application_token='a46e4ad3e18e880a4bcss50c05df66ef3c'' \
--form 'user_token='ochskrxwei4ujsssverxb8w5jfxj1bgnlsw'' \
--form 'version_token='34c4511734ed6a1bf7fe1a642deass0115'' \
--form 'version_module_id='15'' \
--form 's_device='QF37N5A'' \
--form 'process_type='ow'' \
--form 'test_website_url='https://www.google.com''

 

  • The syntax for Mobile with Build_id:
curl --location 'https://{your_domain}.testgrid.io/ci/app_build_run' \
--form 'application_token='a46e4ad3se18e880a4bc50aac05df66ef3c'' \
--form 'user_token='ochskrxwei4ujssverxb8w5jfxj1bgnlsw'' \
--form 'version_token='34sc4511734ed6a1bf7fe1ass642dea0115'' \
--form 'version_module_id='16'' \
--form 's_device='QF38N5U'' \
--form 'process_type='oaa'' \
--form 'app_build_id='27'' \

 

  • Syntax for Mobile with Bundle Identifier:
curl --location 'https://{your_domain}.testgrid.io/ci/app_build_run' \
--form 'application_token='a46e4ad3se18e880a4bc50aac05df66ef3c'' \
--form 'user_token='ochskrxwei4ujssverxb8w5jfxj1bgnlsw'' \
--form 'version_token='34sc4511734ed6a1bf7fe1ass642dea0115'' \
--form 'version_module_id='16'' \
--form 's_device='QF38N5U'' \
--form 'process_type='oaa'' \
--form 'bundle_identifier='Your_Bundle_id''

 

For the Mobile syntax “process_type” parameter we can pass “oaa” for Android and “oia” for Android.

 

Step 9: Once you copy the curl command use it into your YAML File.

  • Coming back to the Azure DevOps dashboard you will be on the review screen, and you will see your YAML File in edit mode.
  • Add the curl command in the YAML file in the script

 

 

Once you review your pipeline YAML file click on save and run top of the right side of the screen.

  • You can commit your code by selecting the “Commit directly to the main branch” option in the save and run window.
  • Next, select the Save and Run button.

 

 

 

Step 10: After clicking the save and run the pipeline will be activated, and your job will be queued for execution.

 

 

Step 11: Navigate to your TestGrid account. Your completed test results can be seen here.

 

 

You could even perform a single test in several browsers/Mobile at the same time.

As simple as that! Happy Testing 😇

 

Table of Contents