Reputation: 788
I want to disable a test by default and want to @enableIf if a certain condition is passed. And I need to execute it with Maven.
I tried with these 2 options:
@EnabledIfEnvironmentVariable(named = "dbmigrationtest", matches = "true")MigrationClass(){}
@EnabledIf("'true' == systemEnvironment.get('dbmigrationtest')")MigrationClass (){}
I tried with these different commands
mvn clean install -Ddbmigrationtest="true" -Dtest=MigrationTest
mvn clean install -DargLine="-Ddbmigrationtest=true" -Dtest=MigrationTest
But the result is always, one test run but 1 test was skipped.
Upvotes: 2
Views: 876
Reputation: 31177
Those are JVM system properties you are referring to, not operating system environment variables.
Thus, you need to use @EnabledIfSystemProperty
instead of @EnabledIfEnvironmentVariable
.
Upvotes: 2