Blogs Banner
How to run Selenium Scripts using Nunit in Azure DevOps CI/CD pipeline?

How to run Selenium Scripts using Nunit in Azure DevOps CI/CD pipeline?

06th Nov, 2019

Play to Listen to the Blog

This post is for those who wish to integrate Selenium with their CI /CD pipeline and trigger automated tests as part of deployment.


Selenium scripts built on the Nunit framework can be triggered as part of CI/CD pipeline from Azure by creating a release pipeline.  The Objective is to run the Selenium scripts as part of CI /CD pipeline and update the test results in Azure DevOps automatically.


The following diagram describes the integration that can be achieved for triggering the test and updating the test results in Azure DevOps automatically.




  • Continuous integration can be achieved by connecting to the source control repository
  • Build can be completed using an agent with desired capabilities
  • Agent can push the build artefacts to the shared repository
  • Test can be triggered from pipeline using Nunit Test Adapters
  • Web API released by Microsoft can be used to update test results back to Azure DevOps


Steps to be followed to achieve the above are detailed below:


1. Installation and Configuration of build agent


2. Creation of build pipeline


3. Triggering build


4. Updating test results to Azure DevOps



Installation and configuration of build agent


Build agent with desired capabilities are required to build the code and deploy to the repository. Details for installing and configuring agent is available in the below link:


Creation of build pipeline


Build pipeline can be created under Pipelines > Builds inside Azure DevOps project. New Build Pipeline can be created by completing the following:


1. Connect: Select the location at which your code is version controlled


2. Select a template: You can select the preferred template and, in my case, selected .NET Desktop


3. Inside the pipeline, specify the agent details


4. Mention the source and the path


5. Use Nuget for restoring packages


6. Build Solution: Input the build details as per the Visual Studio version and MS Build architecture


7. Publish Symbols Path: Input the path to symbols folder with pattern (eg: $(Build.SourcesDirectory))


8. Copy Files and Publish Artefact to desired location


9. VsTest Assemblies: This is the place where you must mention the test adapters and the DLL which you wish to run using the adapters. The expectation is that the artefacts are published to the desired location (with the DLLs and packages) to run the Selenium Nunit scripts. Use the Custom test adapter path as the location to Nunit Console (nunit3-console.exe) and in the Test Files, mention the DLL location



Trigger the build and you should be able to see that the test got triggered automatically and Selenium scripts will start running.


Updating test results to Azure DevOps


In order to update test results to Azure DevOps, Web API released by Microsoft can be used. As part of the Selenium test run, the APIs can be called, and test results can be updated. For more details

About the author

Vishnu Vijayakumar | Senior Consultant

The author is experienced in automation testing using tools like Selenium, Appium, TestComplete and UFT. He is also experienced in DevOps with extensive knowledge in domains like Banking, E-Commerce & Cloud Services. His prime focus is now in leading the  developing solutions for the research and development team.