Running Visual Studio Unit Tests From TestComplete

Applies to TestComplete 15.45, last modified on December 01, 2022

You can include unit tests created with MSTest in your TestComplete projects and run them directly in TestComplete. This way you can integrate Visual Studio unit tests into the collection of tests that you use to test your application(s).

To run MSTest unit tests in TestComplete:

  1. Set the path to the MSTest command-line executable (MSTest.exe) in the Tools > Options > Unit Testing dialog.

  2. Add a Selenium or Unit Testing item to your project:

    1. Right-click your project’s node in the Project Explorer and choose Add | New Item from the context menu.

    2. TestComplete will open the Create Project Item dialog.

      The Create Project Items dialog
    3. Select Selenium or Unit Testing in the list of available project items. If needed, enter the item name and the location of the item file. Click OK.

    TestComplete will add a new project item to your project.

  3. Add a unit test of the MSTest type to the Selenium or Unit Testing collection:

    1. Right-click the Selenium or Unit Testing collection in Project Explorer, then click Add | New Item.

    2. In the Create Project Item dialog, select MSTest in the list of available test types.

      Creating a new MSTest item.
    3. Enter the test name.

    4. If needed, enter the location of the file that will store the test settings.

    5. Enter the path to the assembly storing the needed MSTest tests. You can also click the ellipsis button and browse for the needed file.

    6. Click OK.

  4. TestComplete will add a new MSTest item to your project.

You can edit properties of the added MSTest item in the MSTest Unit Test editor.

After adding the MSTest item to your project and specifying its parameters, you can use this item in your TestComplete projects: run it as a test item, run it from your scripts, and so on.

See Also

Integration With Microsoft Visual Studio and Azure DevOps
Adding and Removing Project Items and Their Child Elements
Unit Testing Options Dialog

Highlight search results