Setting system properties when using junitPlatform

I could not learn how to set the system properties when running JUnit 5 tests using Gradle. The standard test task can be configured as follows:

 test { systemProperty 'org.slf4j.simpleLogger.defaultLogLevel', 'warn' } 

However, the junitPlatform task does not seem to have such an option.

+5
source share
1 answer

Update:

Note that the junit-platform-gradle-plugin developed by the JUnit Team is deprecated in JUnit Platform 1.2 and is no longer supported in 1.3. Please switch to the standard Gradles test task in Gradle 4.6 or higher. Details here .


As I mentioned here , if you are still using the deprecated junit-platform-gradle-plugin you can set the system properties as follows:

 afterEvaluate { def junitPlatformTestTask = tasks.getByName('junitPlatformTest') junitPlatformTestTask.systemProperty 'org.slf4j.simpleLogger.defaultLogLevel', 'warn' } 
+11
source

Source: https://habr.com/ru/post/1493373/


All Articles