This message was deleted.
# community-support
s
This message was deleted.
s
I noticed that I had one @BeforeClass method to set up some system properties. Removing this, my tests executes properly and obvious fail as it depends on system property
Copy code
@BeforeClass
    public static void assumeFeatureFlag() {
        assumeTrue("Feature flag is enabled", Boolean.parseBoolean(System.getProperty(FeatureFlags.REP_TYPE)));
    }
Tests are getting ignored because of assumeTrue method where flag (sys property) is always false. I think i am missing mechanism to set the system property.
v
This question has absolutely nothing to do with Gradle. It is purely about whatever test framework you are using. Besides that, the test is doing exactly what you tell it to. Assume the flag is true or else skip the test.
t
Two things: •
Boolean.parseBoolean(System.getProperty(…))
is equivalent to
Boolean.getBoolean(…)
• To set the system property for your tests, configure it on your test task: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.testing.Test.html
v
Or he simply sets the property in the
@BeforeClass
method using
System.setProperty
and maybe resets it to the previous value in
@AfterClass
. With Spock as testing framework this could simple be done using a
@ResetSystemProperties
Annotation on the test. 🙂