tuk
tuk

Reputation: 6852

Intellij IDEA - Identifying all junit tests which are ignored

Can someone let me know is there a way I can identify all JUnit tests which are ignored i.e either @Ignore being added to the method or @Test is missing on the method in IntelliJ IDEA?

Upvotes: 2

Views: 621

Answers (1)

glytching
glytching

Reputation: 47865

Finding test classes which contain the @Ignore annotation can be done with Edit > Find > Find in Path ...

enter image description here

Finding test classes where "@Test is missing on the method" is trickier because any class can be a test class. Or to put it another way; a class is deemed a "test class" if (a) it is located in the test source tree and (b) it has at least one public method annotated with @Test. So, the absence of @Test would preclude a class from your search. So, perhaps you are looking for classes which meet these criteria:

  • Having at least one method annotated with @Test
  • Having at least one public method which is not annotated with @Test

This would require a Structural Search, accessed from Edit > Find > Search Structurally. There are numerous canned templates available:

enter image description here

Upvotes: 1

Related Questions