PyUnit is a standard unit test framework for Python.
In TestComplete, you can run Python unit tests and Selenium tests created by using the PyUnit testing framework as part of your TestComplete project. In the PyUnit Test editor, you configure the tests to be run.
To learn about TestComplete support for third-party unit testing frameworks, see —
To learn about TestComplete support for Selenium WebDriver tests, see —
To run the PyUnit tests, specify the path to the Python executable (python.exe) in the Unit Testing Options dialog.
To open the dialog, select Tools | Options from the TestComplete main menu and then select Engines | Unit Testing in the resulting Options dialog.
To run Selenium tests, make sure that your computer and TestComplete project meet the requirements described in Integration With Selenium - Prerequisites.
1. Prepare Your Test Machine, TestComplete and Tests
Make sure that the computer where you will run tests, TestComplete and your tests are prepared for testing.
To learn how to prepare Selenium tests for testing, see –
Copy your PyUnit test files to your TestComplete computer.
2. Configure Your TestComplete Project
Open your TestComplete test project or create a new one.
Add a Selenium or Unit Testing collection to your test project. See Adding and Removing Project Items and Their Child Elements.
Add a PyUnit item to the created collection.
3. Configure the PyUnit Item to Run Needed Tests
In Module, enter the path to your Python module (.py) that contains needed tests. You can click the ellipsis button and browse for the Python module in the subsequent dialog.
Select the mode you want to use to run tests:
To run all tests defined in your Python module, select Run all tests from the module in the Modes section.
To run only specific tests, select Run specified tests in the Modes section.
On the Tests list, specify the tests you want to run. To add a test, click Add and enter the test routine name. For example,
To run all test methods defined in a test case, enter the test case class name, for example,
To remove a selected test from the list, click Remove. To temporary exclude a test from a test run, clear the check box next to the test name in the list.
4. Run the PyUnit Test Item
Run the PyUnit test item in TestComplete. For information on how to run unit test items, see Running Unit Tests.
TestComplete will command PyUnit to run the specified tests.
After the test run is over, view the test results.