Increase test coverage
Scenarios where this feature can be useful
- You're working with legacy code, planning to take it over for maintenance, and want to document the current behavior of the code to avoid breaking it later
- You're refactoring complex code and want to guarantee that you won't break anything
- Your company has a quality gate for test coverage, e.g., 80%
How to use
- Next to a method or class, click the
Explyticon and selectExplyt: Analyze and Increase Test Coverage - The plugin will find tests for this class and run them with instrumentation to measure coverage
- Note: Running the found tests may take some time. It may be slightly longer than a normal run of the same tests due to code instrumentation.
- The plugin will display line and branch coverage in existing tests.
- If you click
View covered lines, you'll see covered instructions in the code. - Red and green colors highlight uncovered and covered lines in the code, respectively
- If a line has no color, its coverage doesn't make sense (e.g., it's a field declaration)
- If you click
- Click
Increase Test Coverage- The plugin will start generating additional tests
- During generation, the plugin will: add new tests, run them with instrumentation, and fix errors
- The plugin will display the result of increased coverage by lines and branches
- If coverage is not sufficient, you can continue the process by returning to step 3.
How is this different from simple AI scripts like Qodo-Cover?
The key difference lies in our use of formal mathematical methods.
Intuitively, tests and test data are generated using formal methods, and AI is used at the end to refine the obtained tests (to match the project style).
| Developer | Other tools | Explyt | |
|---|---|---|---|
| Generation method | Human effort | Pure AI | Formal methods + AI |
| Can generate tests from scratch? | Yes | Yes | Yes |
| Can "break through" code when coverage is already quite high? | No (won't, too time-consuming) | No | Yes |
| Is there a guarantee of increased coverage? | Probably not | No: tests are generated randomly | Yes: tests are generated to guaranteed reach uncovered lines |
| Time cost | Very high | High | Medium |