java - Create a copy of Gradle Test task -


i need run project tests both locally , automatically on teamcity server.

local test execution must use local database connection, , when run on teamcity, tests must use remote connection database.

so need tell tests, when use local connection , when use remote , pass url, username , password in case.

to tell decided use java system properties. found built-in support in gradle that

systemproperty 'some.prop', 'value' 

the question is, how can create standard test task local test run, not pass properties, , custom test task, set system properties before run?

i tried

task teamcitytest(type : test) {     scanfortestclasses = false     includes = ['**/*test.class']     systemproperty 'some.prop', 'value' } 

but failed npe, means i'm doing wrong.

the approach fine (you can use java plugin's test task running tests locally), you'll have configure further properties teamcitytest such classpath = configurations.testruntime (or classpath = test.classpath). full example, see samples/java/withintegrationtests in gradle-all distribution.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -