Recipe Name:
JUnit 5: @Disabled Description
Description:
Add a description to indicate why the test has been disabled.
Level:
warning
Language:
- java
Tags:
- testing
- framework specific
- JUnit 5
- quality
Documentation
Whenever a test is disabled, e.g. using the @Disabled
annotation, a reason for disabling the test should be added. The @Disabled
annotation supports this by providing an argument.
@Disabled void thisTestIsDisabled() { ... }After
@Disabled("TODO: Add a reason for disabling the test") void thisTestIsDisabled() { ... }References
Recipe
id: scw:java:junit5:disabled-description version: 10 metadata: name: 'JUnit 5: @Disabled Description' shortDescription: Add a description to indicate why the test has been disabled. level: warning language: java enabled: true descriptionFile: descriptions/JUnit_Disabled_Description.html tags: testing;framework specific;JUnit 5;quality search: annotation: type: org.junit.jupiter.api.Disabled without: parameters: - {} availableFixes: - name: Add a todo comment parameter actions: - rewrite: to: '{{{ . }}}("TODO: Add a reason for disabling the test")' target: self