Using Visual Studio Team Test for running tests in Developer Environment
A developer environment is typically a development machine where the product sources and corresponding unit tests are present in an enlistment. Many a times, a developer may need to block their feature development in order to run unit tests for some of the bugs in their queue. It is a productivity blocker because many instances of unit tests needs to be run in unattended mode[ in case of Functional tests specially ]
Visual Studio Team Test [VSTT] comes to the rescue in these situations !
VSTT encompasses a Test Controller-Test Agent setup for facilitating Remote Execution of automated tests. The following will briefly give an idea of the High level architecture .
Prerequisites :
- Development machine has Visual Studio Team System installed with product and test sources
- A Test machine that is a mimic of the Developer machine [ where the tests will be run ]
Setting up the Controller - Agent :
- Install VSTT Controller on the Developer machine using the below steps and configure it appropriately
- Enter the credentials, in case the tests needs to be run on a different credential from Network Service
- Apply Settings
- Install VSTT Agent on the test machine, which is already setup with all the needed configuration and settings for the unit tests to run
- Enter the credentials, in case the tests needs to be run on a different credential from Network Service
- Connect the Agent to the configured Controller which is setup above
- Apply Settings
Note : In case of running Automated UI tests [ or CodedUITest ], the Agent should be running as an Interactive process instead on Service to act on the UI Components under desktop.
Running Test using Controller - Agent :
- Open the product sources in Visual Studio along with the corresponding test entities [ including *.testSettings ]
- Open Test-Settings file and Click on Role, and Select "Remote Execution" and Enter the Test Controller machine name .
- In order to control the load on each of the agents, we can Filter the Agents in which the tests needs to run by giving a Attribute Name and Value condition. These Attributes are assigned via "Manage Test Controllers" options under "Test" menu in Visual-Studio IDE
- Start running tests from Test View and see the results in "Test Results" pane.
Advanced Options :
Controller - Agent setup allows the test to collect more information from the test machine using "Data Collectors"
- Some of the Data Collectors are Event Log, System Information and Code-coverage
Deployment :
- Test Binaries and dependant binaries needs to be given as Deployment Files and Folders in Test settings
- So the best practice would be to build the solution with Outdir path set in Build Command and use the corresponding Folder in Test settings
Note : The Symbol “*” beside the name of the Agent indicates that it is running as an Interactive process and is ready top run CodedUITest or any Automated tests that interacts with desktop