Skip to main content

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

  1. Next to a method or class, click the Explyt icon and select Explyt: Analyze and Increase Test Coverage
  2. 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.
  3. 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)
  4. 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
  5. The plugin will display the result of increased coverage by lines and branches
  6. 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).

DeveloperOther toolsExplyt
Generation methodHuman effortPure AIFormal methods + AI
Can generate tests from scratch?YesYesYes
Can "break through" code when coverage is already quite high?No (won't, too time-consuming)NoYes
Is there a guarantee of increased coverage?Probably notNo: tests are generated randomlyYes: tests are generated to guaranteed reach uncovered lines
Time costVery highHighMedium