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
Post a Comment