Guel135
Guel135

Reputation: 788

Junit 5 (jupiter) conditional executions with Maven

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

Upvotes: 2

Views: 876

Answers (1)

Sam Brannen
Sam Brannen

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

Related Questions