android / android/nowinandroid
[Bug]: TestMethodNameDetector does not scan all tests
- Dominant language
- Kotlin
- Stars
- 21.8k
- Forks
- 4.6k
- Avg merge
- 19h 20m
- Merged PRs (30d)
- 2
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Is there a StackOverflow question about this issue?
- [x] I have searched StackOverflow
### What happened?
1. Go to `InterestListsDetailsScreenTest.kt`
2. Change one of the test names to include the prefix `test_`
#### Expected
TestMethodNameDetector should issue a warning, both in the IDE and in tasks like `gradle :app:lintAnalyzeDemoDebugUnitTest`
#### Actual
No warning
The reason this is happening is because the annotations on the tests in `InterestListsDetailsScreenTest.kt` have `AnnotationUsageType.DEFINITION` which the `TestMethodNameDetector.kt` does not currently opt-in to scan for. Will submit a patch.
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Contributor guide
Research direction
Start with TestMethodNameDetector.kt and the annotations used in InterestListsDetailsScreenTest.kt, then run gradle :app:lintAnalyzeDemoDebugUnitTest. Check how annotation usage types are selected for scanning. Done means a test method renamed with the test_ prefix produces a warning both in the IDE and in the Gradle lint task.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100