Unit Testing

Index of All Documentation » Wing Pro Reference Manual »


Wing Pro's Testing tool provides a convenient way to run and debug unit tests written using the standard library's unittest and doctest modules, pytest, nose, and the Django testing framework.

Adding Tests

Tests are added from the Testing menu, with Add Single File and Add Current File to add individual files, or with Add Files from Project to apply a filter to the set of all files in the project. For details, see Project Test Files.

The testing framework used to run files is selected with Default Test Framework under the Testing tab of Project Properties or with Test Framework under the Testing tab of File Properties for individual test files.

Running Tests

To run tests, press the Run Tests button in the Testing tool, or use one of the items in the Testing menu. For details, see Running and Debugging Tests.

While tests are running, the Testing tool updates to indicate the status of the run. After the tests have finished running, the status icon for each test will change to indicate the result of the run:

pass indicates the test passed

fail indicates the test failed

skip indicates the test was skipped

unknown indicates the test was not run or did not complete

Viewing Test Results

Individual tests may be expanded to show output generated by the test or any exception that occurred. Exceptions, including any PEP 3134 chained exceptions, may be expanded to display tracebacks.

Collapse All Tests and Expand All Failed Tests in the right-click context menu in the Testing tool can be used to quickly hide all test details, or show details only for failed tests.

Double-click on any test or use Goto Source in the right-click context menu in the Testing tool to display the source code for the test in the editor.

To focus on a subset of the test files, enter a fragment matching those test file names into the File Filter field in the Testing tool. Restore the field to blank redisplays the entire lists of tests.

Output shown for tests may optionally be wrapped to fit the display by checking the Wrap Output Lines item in the right-click context menu on the Testing tool.

Section Contents