spring-projects / spring-projects/spring-framework
Support @TestPropertySource at method level [SPR-14378]
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 60.2k
- Forks
- 38.8k
- Avg merge
- 5d 2h
- Merged PRs (30d)
- 27
Description
Justin Knowles opened SPR-14378 and commented
@TestPropertySource allows you to set test-suite / class-level properties, but I want test-level properties so I can test drive classes with @ConditionalOnProperty and @Value(${var:default}) type annotations for correct behavior.
I have considered creating separate test suites for each test, but that seems unnatural. I currently manually manage the context within the test to validate the behavior.
Issue Links:
- #13977 Support
@ActiveProfilesat method level - #16647 Support
@ContextConfigurationat method level
8 votes, 14 watchers
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
No files or tests are named in the issue. Start by locating the existing @TestPropertySource handling and review the related method-level @ActiveProfiles and @ContextConfiguration issues; done means test methods can provide distinct property values for conditional and @Value behavior without manually managing the context.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100