Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Have IntelliJ determine if code is only used by tests

Can IntelliJ's code analysis options be configured so that it can tell me if code is only used by tests (mostly unit tests) so that I can remove what is essentially dead code from the project.

like image 945
kierans Avatar asked Jul 24 '13 04:07

kierans


People also ask

How do I check the code coverage of a test class in IntelliJ?

Coverage in the Coverage tool window If you want to reopen the Coverage tool window, select Run | Show Code Coverage Data from the main menu, or press Ctrl+Alt+F6 . The report shows the percentage of the code that has been executed or covered by tests. You can see the coverage result for classes, methods, and lines.

How do I see unused methods in IntelliJ?

In newer versions of IntelliJ it's under Code -> Analyze Code -> Run Inspection by Name. Show activity on this post.

What is toggle auto test in IntelliJ?

Rerun tests automatically In IntelliJ IDEA, you can enable the autotest-like runner: any test in the current run configuration restarts automatically after you change the related source code. Click. Toggle auto-test on the Run toolbar to enable the autotest-like runner.


1 Answers

Specify the scope of your analysis to "Project Production Files", and untick "Include test sources". This will skip any unit tests that are in folders labeled as "test".

like image 184
Makoto Avatar answered Sep 23 '22 02:09

Makoto