Spring-framework: Support @TestPropertySource at method level [SPR-14378]

Created on 17 Jun 2016  路  10Comments  路  Source: spring-projects/spring-framework

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 @ActiveProfiles at method level
  • #16647 Support @ContextConfiguration at method level

8 votes, 14 watchers

test enhancement

Most helpful comment

Any plans on this? It would be very useful to not having to create a separate class each time an application.properties parameter should change for testing.

All 10 comments

Seth Wingert commented

This would be really useful for me as well. I'm doing a lot of custom @AutoConfigure and managing different properties between tests is really tricky since @TestPropertySource only works on the class level.

vijay parashar commented

Any timeline for fixing this issue.

Any plans on this? It would be very useful to not having to create a separate class each time an application.properties parameter should change for testing.

We would love to see this aswell

It would be great to have this feature!

Yes, it麓s needed

Yep, 4 years on, I want this too!

Any updates on this? Would really make testing simpler on conditional properties...

Bump

I need this too!!

Was this page helpful?
0 / 5 - 0 ratings