Test Attributes not being set

126 views
Skip to first unread message

Evan

unread,
Dec 2, 2020, 12:06:59 PM12/2/20
to testng-users
I am having trouble figuring out how I get test attributes to be generated when running tests in a gradle project. 
https://testng.org/doc/documentation-main.html#logging
I have been reviewing the documentation above, and I can see the generateTestResultAttributes boolean can be set via command line, and in Maven but I can't seem to find the documentation anywhere that shows how to set it in the build.gradle test task. 

Below is my test task, and where I am trying to add the boolean to allow me to set test attributes that will show up in the testng-results.xml using the IAttributes setAttribute method. 

test {
useTestNG() {
//run classes in parallel, thread count limited by processor.
options {
parallel = 'classes'
threadCount = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
}
useDefaultListeners = true
//sets the default group to run as smoke-api.*, .* is wildcard.
includeGroups System.getProperty('groups', 'smoke-api.*')
excludeGroups System.getProperty('excludeGroups', 'exclude')
}
//we want display the following test events
testLogging {
events "PASSED", "FAILED", "SKIPPED"
}
reports.html.enabled = false
}

Evan

unread,
Feb 8, 2021, 10:41:11 AM2/8/21
to testng-users
The only way I've found to do this when using gradle is to pull down the testng Repo and build my own snapshot. There doesn't appear to be anyway to set the generateTestResultAttributes in gradle.
Reply all
Reply to author
Forward
0 new messages