How can I start testng suite with arguments via gradle to generate TestResultAttributes

228 views
Skip to first unread message

Lotte

unread,
Jul 20, 2021, 3:17:31 PM7/20/21
to testng-users
I have a gradle Project lwith this test task:

test{
useTestNG() {
useDefaultListeners = true
suites 'src/test/suite.xml'
}
}

and I would like to  start bei test via comandline argument:
-reporter org.testng.reporters.XMLReporter:generateTestResultAttributes=true,generateGroupsAttribute=true

So that i can generate the attributes ino the xml-report "testng-results.xml", too.

⇜Krishnan Mahadevan⇝

unread,
Jul 21, 2021, 7:21:47 AM7/21/21
to testng-users
I couldnt find any way in the built-in TestNG Gradle DSL that can support this.

But you can try something like this

dependencies {
// https://mvnrepository.com/artifact/org.testng/testng
testImplementation 'org.testng:testng:7.4.0'
}


task testngTest(type: JavaExec, dependsOn: [classes]) {
mainClass = 'org.testng.TestNG'
args('src/test/resources/suite.xml', '-reporter',
'org.testng.reporters.XMLReporter:generateTestResultAttributes=true,generateGroupsAttribute=true'
)
classpath = sourceSets.test.runtimeClasspath
}


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribblings @ https://rationaleemotions.com/


--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/testng-users/27ab5be5-2894-498f-9555-214673e9a74en%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages