Unit Test Assistant can identify gaps in test coverage and provide guidance for covering these gaps. You can increase code coverage using Uncovered code recommendations in the the Recommendations tab.
Uncovered code recommendations are displayed after your tests are run and include action links and suggestions to guide you through the process of covering the uncovered source code.
Increasing Coverage with UTA Recommendations
The 'Uncovered code' recommendation must be enabled in UTA preferences (see Configuring Preferences).
When you run your test, UTA will display Uncovered code recommendations in the Recommendations view. Recommendations for the largest uncovered code fragments are displayed first – UTA will guide you through progressively smaller chunks of uncovered code as you address coverage gaps.
To increase coverage, you can either modify or extend existing test cases or clone and modify an existing test case with UTA.
Modifying a Test Case
The Recommendations panel may display hints that describe how the test case should be modified to cover the code. By analyzing the flow of the program, it can provide information about parameter values that satisfy the conditions of flow control statements.
Cloning and Updating a Test Case
The Clone test action displays a list of existing tests that you can copy and modify to quickly increase coverage.
- Click Clone test. UTA will analyze the available tests and recommend the most suitable test to clone.
- Select the test you want to clone. Depending on the test code, the following clone types may be available:
- clone only – UTA makes a copy of the test without changing the test code. You need to manually modify the cloned test.
- clone with suggested value(s) – UTA makes a copy of the test and automatically updates the cloned test – according to the hints. For example:
The automatically updated test:
- Click OK.