Donate with Paypal:
paypal

Support me on Patreon

Available on Jetbrains Marketplace: https://plugins.jetbrains.com/plugin/15063-unit-test-coverage-history-runner

There are some other plugins which automatically re-run tests when a change is detected, but these plugins just use static code analysis to find the tests which directly call the changed code. This does not work if you modifiy a private method which is only indirectly called in a test. This plugin works in this case as well because it saves which methods are called during the runtime of a test.

About

This plugin lets you click on a method in your project and automatically run all the unit tests which cover that method.

Manual (Help)

There are two steps to use the plugin:

    1. First you have to run as many unit tests as you can with the new Unit Test Runner(its icon has 1 red + 1 green triangle and a yellow arrow on top of the triangles). The more tests you run with it, the more coverage information you will have.
      1
    1. To run all the unit tests which cover a particular method in your project, just right click on a method and then choose -> Run Unit Tests Which Cover This Method...(this is not shown for methods without coverage info) Unit tests which cover that method will be automatically started.
      2

Also to reset coverage information (in case unexpected tests are run), you can go to Tools -> Reset Coverage Info...

Limitations

When you encounter any test for which coverage information is not included, file an issue on GitHub. For example the plugin doesn't work when using empty test methods with the Scenario annotation like @Scenario("integration_tests")

Credits

IntelliJ IDEA Code Coverage Agent: https://github.com/JetBrains/intellij-coverage