Azure Devops and Selenium

By Jochen D.

Azure Devops, formerly Team Foundation Server and Visual Studio Team System, is an online CI system created by Microsoft.


TestingBot has added an extension to the Azure Devops Marketplace that provides integration with TestingBot.


The extension allows you to:

  • Set your TestingBot credentials as environment variables to be used with your Automated Tests.
  • Start/Stop TestingBot Tunnel for each build.
  • See test results, together with a video, screenshots and logs from inside Azure Devops.

Installation

1. Go to to Visual Studio Marketplace and download the TestingBot extension.

2. Configure the TestingBot credentials to be used with this extension:

  • Go to Project Settings, under the Pipelines section, select Service connections.
    Create a new Service Connection, choose TestingBot credentials and enter your username (TestingBot API Key) and password (TestingBot API Secret).
    Enter https://api.testingbot.com/v1/ in the Server URL.

3. In your azure-pipelines.yml, add the TestingBot Configuration task. Select the credentials you've added before.
Optionally, you can choose to enable TestingBot Tunnel with this build.

4. Make sure to set the build capability for your tests to be identical to the build identifier generated by Azure Devops. You can get this value through the environment variable TB_BUILD_NAME

5. When the build is complete, you will see a TestingBot tab. This will show an overview of the tests for this build.


Example test with Azure Devops

Copy code
#!/usr/bin/env ruby


require 'rubygems'
require 'selenium-webdriver'

caps = Selenium::WebDriver::Remote::Capabilities.new
caps["browserName"] = "firefox"
caps["version"] = "latest"
caps["platform"] = :WINDOWS
caps["name"] = "My First Test"
caps["build"] = ENV["TB_BUILD_NAME"]

client = Selenium::WebDriver::Remote::Http::Default.new
client.timeout = 120

driver = Selenium::WebDriver.for(
:remote,
:url => "https://API_KEY:API_SECRET@hub.testingbot.com/wd/hub",
:desired_capabilities => caps,
:http_client => client)
driver.navigate.to "http://www.google.com/ncr"
element = driver.find_element(:name, 'q')
element.send_keys "TestingBot"
element.submit
puts driver.title
driver.quit

For more information, please see the Azure Devops documentation.

Ready to start testing?

Start a free trial