Thanks for detailed explanation. I was not aware that there is a difference in running directly from gradle and invoking it via IDEA.
So something like this code solved my problem
tasks.withType(Test) {
doFirst {
def result = filter.commandLineIncludePatterns ? filter.commandLineIncludePatterns[0] :
filter.includePatterns ? filter.includePatterns[0] : "UI tests"
result = result.replace("*", "")
systemProperty "testsFilter", result
}
}
Thanks for help!