[1614] | 1 | ==========================================================================
|
---|
| 2 | Visual Studio Team System: Overview of Authoring and Running Tests
|
---|
| 3 | ==========================================================================
|
---|
| 4 |
|
---|
| 5 | This overview describes the features for authoring and running tests in
|
---|
| 6 | Visual Studio Team System and Visual Studio Team Edition for Software Testers.
|
---|
| 7 |
|
---|
| 8 | Opening Tests
|
---|
| 9 | -------------
|
---|
| 10 | To open a test, open a test project or a test metadata file (a file with
|
---|
| 11 | extension .vsmdi) that contains the definition of the test. You can find
|
---|
| 12 | test projects and metadata files in Solution Explorer.
|
---|
| 13 |
|
---|
| 14 | Viewing Tests
|
---|
| 15 | -------------
|
---|
| 16 | To see which tests are available to you, open the Test View window. Or,
|
---|
| 17 | if you have installed Team Edition for Software Testers, you can also open
|
---|
| 18 | the Test List Editor window to view tests.
|
---|
| 19 |
|
---|
| 20 | To open the Test View window, click the Test menu, point to Windows, and
|
---|
| 21 | then click Test View. To open the Test List Editor window (if you have
|
---|
| 22 | installed Team Edition for Software Testers), click Test, point to Windows,
|
---|
| 23 | and then click Test List Editor.
|
---|
| 24 |
|
---|
| 25 | Running Tests
|
---|
| 26 | -------------
|
---|
| 27 | You can run tests from the Test View window and the Test List Editor window.
|
---|
| 28 | See Viewing Tests to learn how to open these windows. To run one or more
|
---|
| 29 | tests displayed in the Test View window, first select the tests in that
|
---|
| 30 | window; to select multiple tests, hold either the Shift or CTRL key while
|
---|
| 31 | clicking tests. Then click the Run Tests button in the Test View window
|
---|
| 32 | toolbar.
|
---|
| 33 |
|
---|
| 34 | If you have installed Visual Studio Team Edition for Software Testers, you can
|
---|
| 35 | also use the Test List Editor window to run tests. To run tests in Test List Editor,
|
---|
| 36 | select the check box next to each test that you want to run. Then click the
|
---|
| 37 | Run Tests button in the Test List Editor window toolbar.
|
---|
| 38 |
|
---|
| 39 | Viewing Test Results
|
---|
| 40 | --------------------
|
---|
| 41 | When you run a test or a series of tests, the results of the test run will be
|
---|
| 42 | shown in the Test Results window. Each individual test in the run is shown on
|
---|
| 43 | a separate line so that you can see its status. The window contains an
|
---|
| 44 | embedded status bar in the top half of the window that provides you with
|
---|
| 45 | summary details of the complete test run.
|
---|
| 46 |
|
---|
| 47 | To see more detailed results for a particular test result, double-click it in
|
---|
| 48 | the Test Results window. This opens a window that provides more information
|
---|
| 49 | about the particular test result, such as any specific error messages returned
|
---|
| 50 | by the test.
|
---|
| 51 |
|
---|
| 52 | Changing the way that tests are run
|
---|
| 53 | -----------------------------------
|
---|
| 54 | Each time you run one or more tests, a collection of settings is used to
|
---|
| 55 | determine how those tests are run. These settings are contained in a “test
|
---|
| 56 | run configuration” file.
|
---|
| 57 |
|
---|
| 58 | Here is a partial list of the changes you can make with a test run
|
---|
| 59 | configuration file:
|
---|
| 60 |
|
---|
| 61 | - Change the naming scheme for each test run.
|
---|
| 62 | - Change the test controller that the tests are run on so that you can run
|
---|
| 63 | tests remotely.
|
---|
| 64 | - Gather code coverage data for the code being tested so that you can see
|
---|
| 65 | which lines of code are covered by your tests.
|
---|
| 66 | - Enable and disable test deployment.
|
---|
| 67 | - Specify additional files to deploy before tests are run.
|
---|
| 68 | - Select a different host, ASP.NET, for running ASP.NET unit tests.
|
---|
| 69 | - Select a different host, the smart device test host, for running smart device unit tests.
|
---|
| 70 | - Set various properties for the test agents that run your tests.
|
---|
| 71 | - Run custom scripts at the start and end of each test run so that you can
|
---|
| 72 | set up the test environment exactly as required each time tests are run.
|
---|
| 73 | - Set time limits for tests and test runs.
|
---|
| 74 | - Set the browser mix and the number of times to repeat Web tests in the
|
---|
| 75 | test run.
|
---|
| 76 |
|
---|
| 77 | By default, a test run configuration file is created whenever you create a
|
---|
| 78 | new test project. You make changes to this file by double-clicking it in
|
---|
| 79 | Solution Explorer and then changing its settings. (Test run configuration
|
---|
| 80 | files have the extension .testrunconfig.)
|
---|
| 81 |
|
---|
| 82 | A solution can contain multiple test run configuration files. Only one of
|
---|
| 83 | those files, known as the “Active” test run configuration file, is used to
|
---|
| 84 | determine the settings that are currently used for test runs. You select
|
---|
| 85 | the active test run configuration by clicking Select Active Test Run
|
---|
| 86 | Configuration on the Test menu.
|
---|
| 87 |
|
---|
| 88 | -------------------------------------------------------------------------------
|
---|
| 89 |
|
---|
| 90 | Test Types
|
---|
| 91 | ----------
|
---|
| 92 | Using Visual Studio Team Edition for Software Testers, you can create a number
|
---|
| 93 | of different test types:
|
---|
| 94 |
|
---|
| 95 | Unit test: Use a unit test to create a programmatic test in C++, Visual C# or
|
---|
| 96 | Visual Basic that exercises source code. A unit test calls the methods of a
|
---|
| 97 | class, passing suitable parameters, and verifies that the returned value is
|
---|
| 98 | what you expect.
|
---|
| 99 | There are three specialized variants of unit tests:
|
---|
| 100 | - Data-driven unit tests are created when you configure a unit test to be
|
---|
| 101 | called repeatedly for each row of a data source. The data from each row
|
---|
| 102 | is used by the unit test as input data.
|
---|
| 103 | - ASP.NET unit tests are unit tests that exercise code in an ASP.NET Web
|
---|
| 104 | application.
|
---|
| 105 | - Smart device unit tests are unit tests that are deployed to a smart device
|
---|
| 106 | or emulator and then executed by the smart device test host.
|
---|
| 107 |
|
---|
| 108 | Web Test: Web tests consist of an ordered series of HTTP requests that you
|
---|
| 109 | record in a browser session using Microsoft Internet Explorer. You can have
|
---|
| 110 | the test report specific details about the pages or sites it requests, such
|
---|
| 111 | as whether a particular page contains a specified string.
|
---|
| 112 |
|
---|
| 113 | Load Test: You use a load test to encapsulate non-manual tests, such as
|
---|
| 114 | unit, Web, and generic tests, and then run them simultaneously by using
|
---|
| 115 | virtual users. Running these tests under load generates test results,
|
---|
| 116 | including performance and other counters, in tables and in graphs.
|
---|
| 117 |
|
---|
| 118 | Generic test: A generic test is an existing program wrapped to function as a
|
---|
| 119 | test in Visual Studio. The following are examples of tests or programs that
|
---|
| 120 | you can turn into generic tests:
|
---|
| 121 | - An existing test that uses process exit codes to communicate whether the
|
---|
| 122 | test passed or failed. 0 indicates passing and any other value indicates
|
---|
| 123 | a failure.
|
---|
| 124 | - A general program to obtain specific functionality during a test scenario.
|
---|
| 125 | - A test or program that uses a special XML file (called a “summary results
|
---|
| 126 | file”), to communicate detailed results.
|
---|
| 127 |
|
---|
| 128 | Manual test: The manual test type is used when the test tasks are to be
|
---|
| 129 | completed by a test engineer as opposed to an automated script.
|
---|
| 130 |
|
---|
| 131 | Ordered test: Use an ordered test to execute a set of tests in an order you
|
---|
| 132 | specify.
|
---|
| 133 |
|
---|
| 134 | -------------------------------------------------------------------------------
|
---|
| 135 |
|
---|
| 136 |
|
---|