This document describes how you can run a test that implements Applitools Eyes visual UI testing from within the build environment, and then see the results in the VSTS Build result window.
The article assumes that you already have VSTS installed on your system and that you know how to use it. Note that depending on your version of VSTS, some of the steps or screenshots described here may be slightly different.
Once you have done the one time setup described in this article you will be able run your visual UI test from within the VSTS environment and see the Eyes results within a VSTS build results window as shown below:
Setting up VSTS to work with Eyes involves the following steps:
Each of these is described in the sections that follow.
The Eyes extension automatically generates a Batch name and batch ID and assigns them to environment variables. Your code should access the environment variables and use these values, as shown in the following code:
The batch name defined by the Eyes Extension is composed of the project name and the build definition name as defined in the VSTS environment.
Note that the extension uses environment variables in two different ways.
APPLITOOLS_API_KEY is an environment variable that you need to define in your operating system or in VSTS, as explained in the next section.
The environment variables
APPLITOOLS_BATCH_ID are defined and set by the Eyes SDK VSTS extension; you should not define these variables in your operating system.
The Eyes extension needs access to your Eyes API key. It obtains the value of the key from an environment variable called
APPLITOOLS_API_KEY You can set the environment key externally via your operating system, or you can do it internally in VSTS as follows:
On the "Builds and Release" page, "Builds" tab select your build by clicking on it.
Click on the Edit button.
In the Variables tab, click the Add button.
In the left input field type the name of the environmental variable APPLITOOLS_API_KEY, and in the right field type your API key. To obtain your API key see How to obtain your API key. Click on save, and in the Dialog that opens add a comment and click Save.
Add the Applitools Eyes build task. In VSTS, click on the "Build and Release" tab, then click on the build definition to which you want to add the Eyes task.
Click on the Edit button.
Click on Add Task.
Click on "Check out our Marketplace".
Type "applitools", click the search icon and you should see the Applitools Eyes Integration Extension. Click on the Applitools Eyes Integration Extension.
Click on the Install button.
Wait a bit....
Wait a little bit more...
Click the "Close" button.
Refresh the browser.
Click "Add Task".
In the search box start typing applitools, when the Applitools Build Task appears, put your cursor over it until the "Add" button is displayed and then click it.
The Applitools task appears at the end of the list of tasks.
Drag it up so that it is before the "Build Solution".
Click "Save & Queue", click "Save", add a comment in the popup and click "Save".
You run your test in VSTS in the usual way :
Click the "Queue" button.
Click the "Queue" button on the popup.
Click on the build number of the current job.
This will bring up the VSTS Build results window. Click the Applitools tab, and then, when the test is complete, you will see the main panel of the Applitools Test manager with the results of the current build loaded.
You will see the results of the current job. To see the results of other builds you can select them from the VSTS "Recently Completed" list. You can also enter full Test manager mode where you can see all the results of all your tests runs. To do this do as follows: