Quantcast
Channel: CrossBrowserTesting Support
Viewing all articles
Browse latest Browse all 17

Azure Pipelines

$
0
0

Getting Started with Azure Pipelines and CrossBrowserTesting

For this document, we provide complete example files in our Azure Pipelines Github Repository.

Azure Pipelines is a continuous integration tool that lets you automate your development process quickly, safely, and at scale. Through Azure Pipelines’ integration with GitHub, GitHub Enterprise, Azure Repos Git & TFVC, Bitbucket Cloud, and Subversion, every time you commit code, a build is created and automatically run in a clean container or virtual machine, allowing you to test every commit.

In this guide we will use Azure Pipelines with Github for testing using the Selenium Webdriver and the Python programming language.

Setting up Azure Pipelines

1. Sign into your Azure DevOps organization or follow the detailed guide here to create a new one.

2. Install the CBT for Azure DevOps extension for your organization

3. Navigate to your GitHub account and create a new repository.

4. Add file test_selenium.py


from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
import os, time

username = os.getenv("CBT_USERNAME")
authkey = os.getenv("CBT_AUTHKEY")


caps = {
 'platform': 'Windows',
 'browserName': 'Chrome',
}

driver = webdriver.Remote(
    command_executor="http://%s:%s@hub.crossbrowsertesting.com/wd/hub"%(username, authkey),
    desired_capabilities=caps)



driver.get("http://www.google.com")
if not "Google" in driver.title:
    raise Exception("Unable to load google page!")
elem = driver.find_element_by_name("q")
elem.send_keys("CrossBrowserTesting")
elem.submit()
print(driver.title)
driver.quit()

5. Add file requirements.txt

requests==2.22.0
selenium==3.141.0

Building Your Pipeline

1. From the Azure DevOps dashboard Dashboard, create a new project and select Pipelines

2. Create a new pipeline  and set up your GitHub repo

3. Add a new Service Connection from the Project Settings page using the type CBT Credentials

4. Add the CrossBrowserTesting Configuration task to your azure-pipelines.yml file

5. Save and Run

You should see your build start to run in Azure Pipelines and in the CrossBrowserTesting app here.

If you have any questions or concerns, feel free to get in touch.


Viewing all articles
Browse latest Browse all 17

Latest Images

Trending Articles





Latest Images