Getting empty TestNG group lists in Gradle -
i have big testng suite invoked via 'test' task in gradle. suite runs fine, i'm having difficulty asking gradle test suite information. specifically, lists of include , exclude groups.
my group configuration in testng.xml looks this:
<groups> <run> <exclude name="notready" /> </run> </groups>
my goal provide means user specify include/exclude groups @ runtime using command line properties, , add them appropriate lists in testng config. catch is, still need respect existing include/exclude config in testng.xml file.
here's brief build.gradle example of i'm trying in task block (minus command line parsing keep code simple):
test { usetestng() { suites("src/test/resources/testng.xml") set<string> excludegroups = getexcludegroups() // returns empty set excludegroups.add("someothergroup") setexcludegroups(excludegroups) } }
i expect excludegroups ['notready'], instead empty set. same thing happens getincludegroups() well. suspect because suites() doesn't load , parse xml file(s) when called, have no evidence up.
i've been poring on testngoptions docs, i'm not sure if i'm doing wrong or if that's expected behavior. can work around problem defining default include/exclude lists in build.gradle instead of testng.xml, feels kind of clunky. if shine light on me, appreciated.
thanks,
andy
you can make groups configurable @ runtime xml using beanshell.
ref : http://testng.org/doc/documentation-main.html#beanshell
Comments
Post a Comment