Skip to content

Continuous Integration with WinAppDriver

Paul Campbell edited this page May 22, 2018 · 5 revisions

Configuring Remote Agent on VSTS for UI Automation

WinAppDriver integration on Visual Studio Team Services (VSTS) requires deploying a custom agent on a Windows 10 based machine. This can be an Azure VM or your own personal computer. Setting up the agent on your target-machine will allow that machine to be used by VSTS to build, deploy, and run your solutions with WinAppDriver UI automation.

Before setting up the agent on your Azure VM, ensure the following prerequisites are met:

  • Machine is running Windows 10 (Home, Professional, or Server 2016).
  • WinAppDriver (V1.0+) has been installed.
  • Visual Studio 2017 installed with VS Unit Tests added.

Once met, complete the following steps to configure the agent:

  1. Preparing Permissions
    • You will first have to authenticate the agent with your VSTS personal access token (PAT). Detailed instructions can be found here.
      • PAT can be created from security panel, found on the following address:
      https://{your_server}.visualstudio.com/_details/security/tokens
      • Make sure to save the PAT somewhere secure and accessible.
  2. Downloading agent
    • On your target machine, download the agent as outlined below. Detailed instructions found here.
  3. Configuring the Agent
    • Run config.cmd to initiate configuration on your target-machine.
    • Enter “N” when asked to run agent as service -- this will set the agent to interactive mode.
    • It is recommended to enable auto-startup when prompted by the config tool.

For further instructions in deploying a VSTS agent, please refer to the official documentation here.

Once the agent is fully configured and ready to go, it can be used for the Build or VSTS release pipleines integrating with UI Automation testing.

Setting up the 'UI Automation Test' Phase

The scope of this Wiki is currently limited to only setting up the WinAppDriver UI Automation phase. For additional information on deploying builds on VSTS, please refer to this article.

Now that the Agent has been created, the next step is setting up your VSTS pipeline. Inside our build definition, we create a new phase to handle our WinAppDriver UI Automation. This test phase will follow the tasks as outlined in the following build phase snippet -

  1. Since we’re using a repository with only UI Tests, we decided to create our build pipeline from start using our UWPControls test sample.

  2. The .NET Desktop schema serves as a sufficient template for getting started with deploying WAD through a build pipeline.

  3. Once created, your UIA Automation Phase should look like the following screenshot.

  1. Ensure that your interactive Azure VM agent is selected on your Agent Queue as seen below.

  2. It is recommended to use a PowerShell script to automate the launch of WinAppDriver every time the pipeline is entered. We used the following inline script method

    Start-Process -FilePath "C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe"
  3. Declare Test Assemblies – VsTest task, ensure you have the proper test assemblies declared. Since our build is producing our VS Test cases in the UWPControls.dll, we point towards that.

  4. Ensure correct Agent is declared in the Agent Queue, and queue your pipeline!

Once queued, your agent should initiate build process and execute the WinAppDriver unit tests.

Clone this wiki locally