In this post, we will look into the steps needed to follow to execute a automated test case in VSTS Manual Test and Lab Manager. For more details on how to use the Manual Test and Lab Manager, check this out.

To start with, in this context, let me define an automated test. Automated test in this case (in Manual Test Runner’s context) is always referring to a test case (unit test/web test/coded UI test) that just needs an invocation and all the test steps/activities happen in an automated fashion. Microsoft Test Runner gives a feature to run the automated tests (which are a part of test plan). I’ll now explain the complete integrated scenario of converting a manual test to a automated test case and running that test on Microsoft Test and Lab Manager.

Typical usage scenario that we can envisage would be something like this: A team starts writing tests as per the test plan. These tests are initially manual test cases. Over the course of the project, as the product code gets stabilized, the team would start automating the test cases. These could be invoked either by a user or as a part of a build.

Following are the steps for the workflow described above:

1. Open the solution containing the test cases, add this solution to the source control.

2. Create a build definition and add the solution mentioned above to the build.

2.1 Check out here to know more about Team Foundation Build and creating a build definition.

3. Queue a build from the newly created build definition. This can be done from the Team Explorer by right clicking on the build definition name. (as shown below)

clip_image002[5]

4. Associate the right test method (that needs to be executed in an automated fashion) to the test case. Steps for that are as follows:

4.1: Open that test case to which you want to associate the test method in VS. Click on the “associated automation” tab.

4.2: In the associated automation tab, click on the browse button and select the required test method and click OK. (Check the image below for details)

image

4.3: Save the test case.

5. From here on, the steps are to be executed in Microsoft Manual Test and Lab manager.(I’ll call it MTLM to reduce the typing effort). In MTLM, add the test case (described above) to a test plan. You can find the test case in MTML using the same ID of the test case that you see in VS.

6. Go to the lab center and add a test controller as shown in the pictures below.

clip_image002[7]

clip_image002[9]

7. Click on ‘Environments’ tab in the lab center.

7.1: Click on new in the environment section to create a new environment. In the new environment, leave it to a ‘physical environment’ (this is the default). This scope of this blog is to explain running automated tests in a physical environment. Virtual environment will be taken up separately.

7.2: Add some role in the environment. Any role added should be fine, however, if a role aptly signifies your test environment, go ahead and choose that.

       7.2.1: In the machines section, you need to add a test-agent to the role. As shown below.

clip_image002[11]

7.3: For starters, rest all of the settings can be left to default. However, for advanced settings, users can go modify other sections for greater control on the environment. 

8. Create a ‘Test Setting’ that encompasses the newly created environment. For this, in MTLM, go to the ‘Test Settings’ section in the lab manager.

8.1: While creating a new test setting, select the radio button which says “Run automated tests using a environment’ as shown below:

clip_image002[13]

8.2: Select the environment that's created in the ‘Environment’ section. Rest can again be left to default.

9. Now, assign the newly created test settings to the test plan. This can be done in the ‘Testing Center’. Select the required plan, set the context to that plan and click on ‘Plan Properties’

9.1: Specify the automated setting that is created in the step above.

9.2: Click on modify build and select the build created.

10. Now you are all set to run the tests. Just click on ‘Run’ in the Testing Centre's ‘Test’ section.