Skip to content

Introduce strategy for determining if a profile value is enabled for a particular test environment [SPR-4862] #9538

Closed
@spring-projects-issues

Description

@spring-projects-issues

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:

5 votes, 3 watchers

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: testIssues in the test modulestatus: declinedA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions