During the building of any given product, you may want to run tests after each build in order to scout the basic quality of the new build. Or maybe developers writing different parts of the product would like to run unit tests against their components after each build so that component wide regressions are prevented. Testers can check in their aggregated test automation code into the team project and run all tests each time after compilation so that product wise regressions are caught during build process itself.
With the Visual Studio Team Edition for Testers, you can author test projects with different kinds of tests. These test projects can be written in C#, VB.NET, or C++. Each test project can contain unit tests, generic tests, load tests, ordered tests, ASP.NET unit tests or Web tests. Consider a company using Team Foundation Build has a Web site to maintain. The source code consists of an ASP.NET Web site, a Web service that connects to an external source and a couple of class libraries where the logic of the entire product is stored.
A user creates the desired tests and adds them to appropriate test lists. A test list is an aggregate of tests that can be defined by the user. Note that this test project is part of the Visual Studio solution that contains the projects that this test project is testing. The corresponding solution items – the vsmdi file which is the test metadata file and the run configuration file(s) that contains the test run settings, are all also checked in as part of the solution.
A build type can be configured to run tests after compilation each time a build is kicked off using that build type. In the Options page of the build type wizard:
Now, your build type is ready to run tests when builds are kicked off with this build type.
Once a build is kicked off with tests enabled, the test lists specified are run as part of the build process. In order to view the test results, open the build report and expand the test results tab.
Here, you can see a link to the test results file, the number of tests that have passed, failed, and have a different result. Tests that have a different result other than passed or failed might be load tests that have a status of "Completed" if they ran successfully or tests that might have been "Inconclusive" due to insufficient data being obtained while running the test. When you click on the hyperlink pointing to the test results file, a dialog box opens, prompting you to choose a location where the test results can be downloaded. Upon specifying a location, the test results are downloaded at that location. This is a .trx file and a folder that contains the deployed items and other test binaries. After download, the test results are displayed in the Results window in the Visual Studio client.
Clicking the test run hyperlink takes you to a tabbed window containing the test run details. Double-clicking each of the tests opens tabbed windows each containing the details of that particular test.
We will look at more detailed scenarios around running tests in Team Build in the next part. Meanwhile, please feel free to send any comments/feedback...