openrewrite / openrewrite/rewrite-testing-frameworks
Recipe to add missing `@Test` annotations
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 100
- Forks
- 105
- Avg merge
- 2h 25m
- Merged PRs (30d)
- 9
Description
What problem are you trying to solve?
Find and fix test cases which are forgotten and thus are not executed.
Some heuristics is probably needed to determine if given method is indeed a test case and not some helper method.
This is relevant to JUnit 4+ which uses annotations to determine if something is a test case.
(Possibly other test frameworks use the same approach and the recipe could cover them too).
Describe the situation before applying the recipe
void testAddition() {
int result = calculator.add(2, 3);
Assertions.assertEquals(5, result);
}
Describe the situation after applying the recipe
@Test
void testAddition() {
int result = calculator.add(2, 3);
Assertions.assertEquals(5, result);
}
OSS repro
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by examining the two OSS reproduction pull requests linked in the issue and compare the forgotten test methods with nearby helper methods. Define the heuristics for JUnit 4+ test methods, then implement a recipe that adds @Test only where appropriate and verify that helper methods remain unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100