Exercise 3: Data Driven Demonstration for Coded UI Test

In this exercise, you will add another set of test parameter values to the test case in order to demonstrate that these test parameters are hooked up to the coded UI test and that the validation that we recently added in is performing as expected.

  1. Open Microsoft Test Manager from Start | All Programs | Microsoft Visual Studio 2010 | Microsoft Test Manager 2010.
  2. Click the Test tab and select test suite 7 “As a customer I should be able to remove items from my shopping cart”.

    Figure 20

    Test suite 7 has been selected

  3. Select the test case with ID = 41 and select the Open Test Case button.

    Figure 21

    Opening test case with ID = 41

  4. In the Parameter Values section at the bottom, add a new row with quantity 10.
    Note:
    A value of 10 is a legitimate value for the shopping cart, so the cart will refresh to show a quantity of 10 when this value is entered. However, since the purpose of this exercise is to show what happens when a test iteration fails, we will pretend that this causes the test to fail in order to demonstrate a test case failure. Our assertion expects that the quantity will remain at 1.
  5. Save the changes to the test case and return to Visual Studio.
  6. Run the tests again and note that the test fails on the fourth iteration.
  7. Double-click on the Failed row within the Test Results window to open the test results. Under the section for Data Driven Test Results we are notified that 3 out of 4 tests passed and that the fourth data row failed.

    Figure 22

    Test results showing failed assertion

To give feedback please write to VSKitFdbk@Microsoft.com

Copyright © 2010 by Microsoft Corporation. All rights reserved.