unknown_boundaries
unknown_boundaries

Reputation: 1580

How to run specific test class basis system property 'environment'?

Consider different set of smoke tests to be run in test and prod environments. I've configured the build to hit respective profile to run smoke tests. This build provides the environment as parameter. Is there a way to trigger correct Tests (for example ex: one out of SmokeTestEnvTests.java and SmokeProdEnvTests.java) using this environment system property?

Upvotes: 1

Views: 491

Answers (2)

Matthias
Matthias

Reputation: 323

In JUnit4 you can use Categories and execute all Tests of 1..n Categories with the maven-surefire-plugin (see Using JUnit Categories).

Upvotes: 3

Ori Marko
Ori Marko

Reputation: 58774

Yoy should use different ActiveProfiles for different tests classes

annotation that is used to declare which active bean definition profiles should be used when loading an ApplicationContext for test classes.

Upvotes: 0

Related Questions