Microsoft Visual Studio 2010 – Automated Tests – Overview (en-US)
Introduction
Automated tests are created using Visual Studio. Visual Studio Ultimate or Visual Studio Premium can be used to create a variety of automated tests, which enable efficient and effective testing of an application.
Automated test runs test steps automatically when executed and also validates the test result against expected result. The tests will pass or fail based on the expected output. Automated tests are quick to run and can be executed more frequently to quickly test if an application is working correctly. Following are the types of tests which can be created:
- Generic Tests
- Unit Tests
- Coded UI Tests
- Web Performance Tests
- Load Tests
- Database Unit Tests
- Ordered Tests
The following section has description of each type of the automated test.
Generic Tests
Generic tests are used to test functionality using API calls or command line tools for the application under test. Use a generic test to wrap an existing test, program, or third-party tool that can: be run from a command line; return a value of Pass or Fail; or optionally, it also return detailed results for 'inner' tests.
Unit Tests
Unit tests are used to test code at the method level. These tests are used to execute other source code by calling the methods of a class directly, passing appropriate parameters, and then including Assert statements; it can test the values that are produced against expected values.
Coded UI Tests
These tests provide functional testing. Coded UI tests are used to test the user interface of an application by performing UI actions and then performing validations. These tests can test whether the user interface of an application functions correctly. These tests perform actions on the user interface controls of an application and verify the correctness of displayed controls along with the correct values.
Web Performance Tests
Web Performance Tests are used as input to load tests for testing responses of web application servers by communicating using http requests. These tests are used for testing the functionality of web applications and testing web applications under load. Web performance tests are used in performance tests, capacity tests and stress tests.
Load Tests
Load tests are used to test application performance, capacity and stress using any of the: unit tests, web performance tests or coded UI tests. The basic load testing is used to determine the application’s behavior under normal and/or anticipated peak load situations. The goal of her is to simulate many users accessing a server at simultaneously.
Database Unit Tests
Database unit tests are used to test a stored procedure, function or trigger in a database. These tests can be used to establish a baseline state for database and then to verify any subsequent changes made to the existing database objects. Tests are used to verify that the changes have not broken any existing functionality.
Ordered Tests
Ordered tests contain other tests that are expected to run in a specific order. This test appears as a single test in the Test List Editor and the Test View window. Its result also appears in a single row in the Test Results window as a single test. An ordered test can contain any type of test except load tests. But, if an ordered test is executed remotely, or from a command line that contains manual tests, then manual tests are temporarily removed from it for that particular test run, and a warning is displayed.
The table below has details of types of automated tests that can be created. Note that Load tests cannot be created unless you have Visual Studio Ultimate. Manual test cases can be converted to automated tests by linking automation routines (methods) to manual test case and can be run using Microsoft Test Manager. The selection of automated test suitable for you depends on what you need to accomplish as part of automation.
Type |
Run tests from |
Run from a test plan by associating |
Visual Studio |
Visual Studio |
Generic Tests |
Yes |
Yes |
|
Yes |
Unit Tests |
Yes |
Yes |
|
Yes |
Coded UI Tests |
Yes |
Yes |
|
Yes |
Web Performance Tests |
Yes |
Not recommended because Web Performance tests are primarily intended to be used with load tests. |
No |
Yes |
Load tests |
Yes |
Not recommended because you cannot view the test as it runs. |
No |
Yes |
Database Unit Tests |
Yes |
Yes |
|
Yes |