Description
Sam Brannen opened SPR-4862 and commented
ProfileValueSourceConfiguration allows one to configure an implementation for the ProfileValueSource strategy; however, AbstractJUnit38SpringContextTests and SpringJUnit4ClassRunner are currently hard coded to use ProfileValueUtils.isTestEnabledInThisEnvironment() which only matches on an exact value.
It would be beneficial to be able to configure different strategies for determining if a profile value is enabled for the current environment. The above classes could then delegate to the configured strategy. For backwards compatibility, the default strategy should simply delegate to ProfileValueUtils.isTestEnabledInThisEnvironment(); whereas, additional, pluggable strategies (e.g., one using regular expressions) could be provided for greater flexibility.
Further input from #10572:
It is a typical situation when one might have to run a combination of tests belonging to different test-groups. For example, a test method A is part of the 'smoke' test group, and test method B belongs to 'integration' test group. If you want to execute test methods A and B, you have to run two separate JUnit runs: one for 'smoke' and a separate one for 'integration'.
It would be great to have a way to combine tests from more than one test group in a single test run, for example:
% ant -Dtest-groups=smoke,integration run-tests
A strategy which considers the value to be a comma-separated list could provide such support with OR semantics.
Affects: 2.5.4, 2.5.5, 2.5.6
Reference URL: http://forum.springframework.org/showthread.php?p=182516
Issue Links:
- TestContext framework should support declarative configuration of bean definition profiles [SPR-7960] #12615 TestContext framework should support declarative configuration of bean definition profiles
- Allow overriding
@ActiveProfiles
in test classes with system property [SPR-8982] #13622 Allow overriding@ActiveProfiles
in test classes with system property - Introduce annotation to disable test based on active Spring profile [SPR-11677] #16300 Introduce annotation to skip test based on active Spring profile
- Create annotation to group tests [SPR-3653] #8334 Create annotation to group tests
- Allow multiple values be specified in the runtime for tests filtering by @IfProfileValue [SPR-5903] #10572 Allow multiple values be specified in the runtime for tests filtering by
@IfProfileValue
- Allow multiple values be specified in the runtime for tests filtering by @IfProfileValue [SPR-5903] #10572 Allow multiple values be specified in the runtime for tests filtering by
@IfProfileValue
("supersedes")
5 votes, 3 watchers