properties - Gradle task check if property is defined -


i have gradle task executes testng test suite. want able pass flag task in order use special testng xml suite file (or use default suite if flag isn't set).

gradle test 

should run default standard suite of tests

gradle test -pspecial 

should run special suite of tests

i've been trying this:

test {     if (special) {         test(testng_special.xml);     }     else {         test(testng_default.xml);     } } 

but undefined property error. correct way go this?

if (project.hasproperty('special')) 

should it.

note you're doing select testng suite won't work, afaik: test task doesn't have test() method. refer https://discuss.gradle.org/t/how-to-run-acceptance-tests-with-testng-from-gradle/4107 working example:

test {     usetestng {         suites 'src/main/resources/testng.xml'     } } 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -