Many development teams are moving to a more automated approach when it comes to testing. There are many benefits in automation, but these benefits come with a requirement for traceability. Moving to an automated model is often a gradual process. Luckily VSTS allows for a gradual switchover.

Before you begin: Set up your automated test run

Make sure your automated tests work before you begin adding automation to your manual test cases.

#1 Associate your test plan with a release enviornment

When kicking off an automated test run from test manager, VSTS will call Release Management in the background and kick off a defined release.
This release has to be ready to receive a “Test Run” from VSTS. This replaces the need to reference a binary – these references come from the cases and we will set those up in step 3.

To establish the required link between Test Manager and Release Management, access your test plan, and go to the test plan settings.
Select a release and an environment. If you want VSTS to create a template for you, choose “Create New”.

#2 Make sure your automated tests are available to the environment used by your ad-hoc automated run

Over in Release Management, make sure your release and environment draw in the test binaries that you want your cases to use for automation. (Your test binaries must come in via an artifact source)

Note how we are referencing a test run which is an object that will be created on the fly by Test Manager, referencing all the automated cases that we want to run. The cases – in turn – will reference their binaries, which is the next task we need to complete.

#3 Associate your automation

There are two ways of associating your test binaries with your test cases in Test Manager.

(1) Use Visual Studio; Here is how: https://docs.microsoft.com/en-us/vsts/build-release/test/associate-automated-test-with-test-case
(2) Provide the information in the Work Item Dialogue

If you are adding the association in the dialogue or via the REST API, these are the fields that need populating:

The “Automation Status” on the main page of the workitem should also read “Automated”.

#4 Run your tests

Once associated, you will be able to select and run tests as usual. This will now trigger a release against the environment you selected in the plan settings. A test run object will be created and sent across to the release.

This behaviour will replace the automated test run while all other traceability will remain intact.

Find out more: https://docs.microsoft.com/en-us/vsts/build-release/test/run-automated-tests-from-test-hub