This message was deleted.
# community-support
s
This message was deleted.
g
You could register another test task with different system property and select tests to run both in it and original test task. If you use junit5 you certainly could select tests by tags. Another way would be to just use System.setProperty in tests themselves and reset it to original value after.
v
Unless you run tests in parallel, then you also need to properly lock accordingly. With Spock you could simply acquire the global lock to run the test isolated using
@Isolated
when running with parallel enabled and
@RestoreSystemProperties
or how it is called to automatically restore the properties after the test.
s
You could register another test task with different system property and select tests to run both in it and original test task. If you use junit5 you certainly could select tests by tags.
@grossws @Vampire: Thanks for your inputs. Creating a new task seems to be easy option. I am thinking of creating a new task (type Test) something like below assuming it will launch tests in separate JVM.
Copy code
task mySpecialTests(type: Test) {
    include 'com/somepackage/**'
    systemProperty 'some.prop', 'value'
    jvmArgs '-XX:MaxPermSize=256m' --> Does it forces gradle to use separate JVM ?
}
BTW, does gradle launch
Test
type tasks in separate jvm, gradle doc doesn’t say about it.
v
Yes and no. It usually uses a separate test worker process that can be reused for different test tasks, but it should also handle the system properties according to your task setup.