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:
-
Right-click the needed test in Project Explorer.
-
Choose Run Test_Name from the context menu:
Running From Scripts
To run a unit test from scripts, call the UnitTest.Execute
method:
JavaScript, JScript
Python
SeleniumTests.JUnitTest1.Execute()
VBScript
DelphiScript
C#Script
In the example above, SeleniumTests is a sample name of a Selenium or Unit Testing collection, to which your “unit test” item - JUnit1 - belongs:
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 Call Object Method or Run Code Snippet operation to call the Execute
method.
Running As Project Test Items
-
Select your project in Project Explorer and then select View | Organize Tests from the TestComplete main menu. This will open the Test Items page of the project editor.
-
Drag the desired unit test to the Test Items editor.
-
Save the changes by selecting File | Save from the TestComplete main menu.
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 and Test Items
Integration With Selenium