Running Unit Tests

Applies to TestComplete 15.47, last modified on January 20, 2023

In TestComplete, you can run a unit test in various ways. This topic describes them.

Running From the Project Explorer

Selenium or Unit Testing collections in Project Explorer contain all unit tests in your project. To run a test:

  1. Right-click the needed test in Project Explorer.

  2. Choose Run Test_Name from the context menu:

    Running Unit Tests From TestComplete UI

Running From Scripts

To run a unit test from scripts, call the UnitTest.Execute method:

JavaScript, JScript

SeleniumTests.JUnitTest1.Execute();

Python

SeleniumTests.JUnitTest1.Execute()

VBScript

SeleniumTests.JUnitTest1.Execute

DelphiScript

SeleniumTests.JUnitTest1.Execute;

C#Script

SeleniumTests["JUnit1"]["Execute"]();

In the example above, SeleniumTests is a sample name of a Selenium or Unit Testing collection, to which your “unit test” item - JUnit1 - belongs:

Running Unit Tests From Scripts

In your project, the names can differ. For instance, you may have SeleniumTests.PyUnit2.Execute() or UnitTests1.NUnit1.Execute().

Running From Keyword Tests

To run a unit test from a keyword test, use the Run Test operation.

Running Unit Tests From Keyword Test

Running As Project Test Items

  1. Select your project in Project Explorer and then select View > Organize Tests from the TestComplete main menu. This will open the Execution Plan editor of the project.

  2. Drag the desired unit test to the Execution Plan editor.

  3. Save the changes by selecting File > Save from the TestComplete main menu.

    Running Unit Tests as Test Items

When you run your project, TestComplete will run your unit tests.

Viewing the Test Log

After the test run is over, TestComplete will show a test log. The Additional Information panel of the test log will contain the command-line output produced by the appropriate unit testing framework.

If you use the MSTest unit testing tool, the TestComplete test log will report the test results in a specific format. See MSTest Log.

See Also

Integration With Unit Testing Frameworks - Overview
Tests, Test Items, and Test Cases
Integration With Selenium

Highlight search results