Is it possible to let some of the system properties set on a Test task not trigger up-to-date checks?

I’m running cucumber tests against a running web app. These are run on a busy CI server with other projects running their tests. This lead to problems with ports not available when running the tests, and to prevent these, we changed to use random ports. These are communicated to the cucumber tests through system properties, but as these are random the tests will always run (inputs are changed).

I cannot see what to do here except writing my own clone of the test task.

Regards, Stig Kleppe-Jørgensen

Hello,

you should be able remove a particular systemproperty from the up to date check by deferring the configuration of the random port via systemproperties in the execution phase of the test task. something like this should do the trick

test{
 doFirst{
  systemProperty('randomPort', 12645)
 }
 doLast{
  systemProperties.remove('randomPort')
  }
}

cheers, René

Thank you very much, Rene! It works like a champ! I had tried different permutations with doFirst, System.setProperty(…), inputs, but didn’t think of this one :slight_smile: Even tried to make my own Test task, but it stranded on some classloader problems.

Kind regards, Stig