Executing tests within Unit Test Assistant allows you to collect data about the execution flow and use this data to improve the test quality. UTA can analyze a test case during execution to identify issues and display recommendations on how the test can be enhanced. It also automatically collects coverage information for all tests run within the Unit Test Assistant interface.
When you run a test, the JUnit view will automatically open and display general information about test run progress and status.
After test execution, the UTA interface displays execution details in a two-column view.
Execution flow data is displayed in the left column as an expandable tree that helps you analyze execution flow and navigate your code.
Recommendations for test improvements and variables associated with method calls are displayed in the right column. Recommendations include action links that help you navigate the test and introduce changes. The links may vary depending on the recommendation type. However, all recommendations include:
The Variables tab shows the values associated with method calls that can be used to compare the state of an object before and after a method call. See Tracking Object Changes and Creating Assertions for details.
This section shows several examples of Unit Test Assistant recommendations and how they can be used to improve the quality of your test. See Configuring Preferences to customize what type of recommendations UTA will report.
You can click the Learn more... link for details about individual recommendations.
UTA detected that the test does not contain any assertions. Typically, this may happen when you create a new test with UTA and leave the default UTA assertions commented.
Remedy: You can do one of the following:
UTA detected a system property that was added during the test run, but was not removed after execution. As a result, all subsequent tests will have access to that property, which may create dependencies between tests and prevent you from running them in isolation.
Remedy: Ensure that system properties that were added or modified during a test run are removed or restored after execution.
UTA detected an additional thread that was active during the test run. Additional threads may affect test stability and cause random failures.
Remedy: Avoid writing test cases with side threads or ensure that they do not affect test results.
UTA detected a new file that was created during the test run, but was not removed after execution. This may affect subsequent test runs or other tests, as well as hide potential problems within the application.
Remedy: Ensure that the files created by the test are removed before the end of the test run.