The test results are not only useful to see if the
method and class are returning the expected result, but also to analyze
the application and to verify the build. We can add the test as part of
the Team Foundation Server automated build, so that we can verify the
build and make sure the latest code checked in to the source control is
working as expected. The build process produces the same results as we
get when we run the test project and the results are stored in the Test
Results folder. Whenever there is a test failure, we can directly create
a defect from the test results window into the Team Foundation Server
as a work item of type defect.
All the tests run through
the Test List Editor or Test View window. Using the solution explorer
will show the test results in the Test Results
window. This window shows the status of the test and the link to the
test result details. The test name is the same as the test result; .trx is the file created by the test run.
Test as part of Team Foundation Server build
The TFS is the place to maintain the code for all the projects including the test projects. Let us assume that we have a ClassLibrary
project and the unit test project for the class library, and both are
checked into the Team Foundation Server. Whenever there is a change or
fix in the code, the test project has to run and verify that the fix is
producing the expected result.
Team Foundation Server
provides the automated build utility to build the team projects. There
is a set of procedures to be followed to create the build project in
TFS. The screenshot below shows the build project, which contains the
class library project and the test project for the ClassLibrary.
The build project automates
the process of building the projects in the solution selected for the
build and can also run the test project after compiling and building it,
which would verify the code fix. There are some options to be set while
creating the build project.
option shown in the above screenshot selects the solution to build. The
solution can be single or many. When the build starts, the TFS will
start building the solutions as selected in the above screenshot. Once
the solution is selected, the system will display the test lists within
the solution. We can select the test list from the list shown.
The test lists shown in the
above screenshot are the test lists created using the Test List Editor
for the solution. All the test lists belong to the solution we selected
in the previous screen. Each test list may contain more than one test.
The tests in the selected test lists above are run after building the