OZ Digital, LLC

  1. Home
  2. /
  3. Resources
  4. /
  5. Technical Guides
  6. /
  7. The OZ Technical Guide...

The OZ Technical Guide to Running Fast, Efficient Selenium Test Automation Scripts In Azure DevOps

DevOps Icon Set

Download PDF

What You’ll Learn

In this moment of digital transformation ensuring workflows are tested properly after every code change can be a significant challenge.

In the eyes of many, Selenium remains the first-in-class test automation tool for web-based applications—and OZ is here to help you quickly and efficiently get the most out of it with the below guide on the integration of Selenium test automation scripts with Azure DevOps.

I. Keep it simple

  • Install VSTS (Microsoft Visual Studio)
  • Launch “Visual Studio” and open the respective code repo
  • Create a test project in Microsoft Visual Studio

  • Open “Solution Explorer”

  • Hover over “Add”


  • Search “ms test”
  • Select “MSTest Test Project”
  • Click “Next”



  • Right-click on “Test”


Once the test project has been created, it is time to add the required NuGet packages.


  • In “Solution Explorer,” right-click on Dependencies
  • Add “Selenium.WebDriver” and “Selenium.Support” NuGet packages



  • In “Solution Explorer,” right-click on Dependencies
  • Add “Selenium.WebDriver” and “Selenium.Support” NuGet packages



  • Open “Solution Explorer”
  • Right-click on the Solution



  • Under SeleniumTest, create “testhost.runtimeconfig.json”
  • Add above code

Congratulations! You are all set to write test scripts!

II. Writing automation test scripts


  • Under SeleniumTest, create “SeleniumTest.cs” class where source of test scripts written in C# with Selenium binding will be added
  • You may add multiple class files per the framework you are following
  • Run test scripts to fix errors


Before proceeding for integration, it is a good idea to verify the scripts whether theywork correctly or not. (Use “Test Explorer” in Visual Studio.)

III. How to configure AzureDevops: the OZ way


  • Sign up with Azure DevOps
  • Create a project in new Azure DevOps account
  • Create webapp CI/CD pipelines under code repo in the newly created project


Add tasks in CI pipeline

Open CI pipeline then add required tasks to copy and publish Selenium files on server


  • In the left navigation, click on Pipelines then filter pipelines
  • Click on the filtered pipeline



  • Under the Tasks, add “Copy Files to: $(…)” task. Keep all default values.



  • Add “Publish Artifact” task. Keep all default values.


Add tasks in CD pipeline

  • Open CD pipeline then add required tasks to copy and run Selenium test scripts automatically in web browser on server.


  • In the left navigation, click on “Releases” then filter pipelines.
  • Click on the filtered pipeline.



  • Under the Tasks, click on three dots then on “Add an agent job.”



  • Search “Test Plat”
  • Add “Visual Studio test platform installer” task.



  • Keep all default values.



  • Search “VS Test”
  • Add “Visual Studio Test” task.



  • Change dll name to “SeleniumTest.dll” under “Test files”
  • Keep the path intact



  • Select “Test assemblies” in “Select tests using”



  • Check “Test mix contains UI tests” and select Version under “Select test platform using”
  • Also, select “Installed by Tools Installer” under “Test platform version”



  • Check “Upload test attachments”


Executing test scripts

Run CI pipeline automatically

  • Commit code in respective CI pipeline, it will trigger automatic execution.

Run CI pipeline manually


  • Open CI pipeline
  • Click on “Queue”



  • Click “Run”



  • Open CD pipeline
  • Click on “Create release”



  • Click “Create”



The test scripts are being executed.

View Report


  • It shows success and 100% execution of Selenium test scripts
  • Click “100%”


  • Click on filter
  • Select “Passed”
  • View successful test scripts


Ready to optimize and supercharge your processes across the board? Click here to find out what OZ can do for you.