Creating Automated Tests

You can create several types of automated tests using Visual Studio Ultimate or Visual Studio Premium, which enable you to test your application more efficiently. Automated tests run test steps for you and determine whether the test passes or fails. These tests can be run more quickly and more frequently. Automated tests can quickly test whether your application is still working correctly after code changes have been made to your application. Automated tests are created using Visual Studio.


You cannot create load tests unless you have Visual Studio Ultimate.

Later, if you choose, you can convert manual test cases to automated tests by linking automation to the test case. Then these automated tests can be run using Microsoft Test Manager and the results can be reviewed as part of the test plan progress.

The following table shows the types of automated tests that you can create and which types of tests can be run as part of a test plan:

Type of test


Run tests from Visual Studio

Run from a test plan by associating a test method with test case

Coded UI Tests

Tests the user interface by performing UI actions.



Unit Tests

Tests code at the method level.



Database Unit Tests

Tests a stored procedure, function or trigger in a database.



Load tests

Tests application performance and stress using unit tests, Web Performance tests or coded UI tests.


Not recommended because you cannot view the test as it runs.

Web Performance Tests

Used as part of load tests to test server responses for Web applications by sending and receiving http requests.

These tests cannot be used to test the UI.


Not recommended because Web Performance tests are primarily intended to be used with load tests.

Generic Tests

Test functionality using API calls or command line tools for the application under test.



Depending on what you need to accomplish with your testing will determine which types of automated tests you need to create. When you have created these tests, then you can decide if you want to report the results as part of a test plan. The tasks in the table below can help you determine your automated testing needs.



Associated Topics

Creating Tests For Your Requirements, Use Cases or User Stories: After reviewing the users' needs for your application, you can create test cases to cover testing these needs. You can connect each test case to the relevant requirements, use cases or user stories, depending on your project management methodology. You can then associate an automated test with your test case. This links your automated tests to your requirements, use cases, or user stories.

Speed Up Testing Your User Interface: You can create automated user interface tests for your application. These tests can be used to check that there has been no regression or change in the user interface from coding changes.

Improving Code Quality Using Unit Tests: You can automatically generate unit tests from your existing code, or you can create unit tests manually. Unit tests will help improve the quality of your code by ensuring that changes you make do not cause issues in existing functionality.

Test How Your Application Performs Under Heavy Loads: You can create either unit tests or Web Performance tests and use these in load tests. With a load test, you can create a heavy load on your application by simulating multiple users. Then you can measure the performance of your application and check it can still run successfully with a large number of users accessing it.

Test the Functionality of Your Application: If you can access the functionality of your application using API calls or a command line interface, you can create automated tests to drive your application without using the user interface.

Improving Database Code Quality Using Database Unit Tests: You can create database unit tests to verify that the stored procedures, functions and triggers in the database are working correctly. These tests can be run to check that changes to the database or database code do not affect existing database code.

Converting Manual Test Cases to Automated Tests to Run As Part of a Test Plan: You can convert manual test cases to automated tests by adding the details for the automated test to the test case using Visual Studio. Or you can create a test case and add an automated test if you want to run these tests as part of a test plan using Microsoft Test Manager.

Managing Your Automated Tests: You can organize automated tests by marking test methods with a test category attribute. You can then use these groupings to select the tests that you want to run. Or you can convert a test case into an automated test and manage these tests using test plans and suites. You can also use test lists to manage your automated tests.

Running Automated TestsYou can run the tests that you have created locally or remotely using test environments and record the results.

Reporting on Testing Progress for Test PlansYou can measure the progress of your testing if you run your automated tests from a test plan and see the test results.

See Also


Testing the Application