How to enable/disable multiple assertions in a test Suite via groovy script
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to enable/disable multiple assertions in a test Suite via groovy script
I need to enable/disable multiple assertions in a test Suite via groovy script
I know how to disable individual assertion via
testSuite.getTestCaseByName("TestCaseName").getTestStepByName("TestStepName").getAssertionByName( "ConciseResponse" ).disabled = true
But I would like to enable / disable all the assertions named "ConciseResponse" in a test suite via groovy script. Any help would be appreciated
Solved! Go to Solution.
- Labels:
-
Assertions
-
Scripting
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not sure what is happening unless you provide the log. Or it is possible to have an issue with copy paste, sometimes, different characters are pasted. Please look in that front as well.
Or you can create a simple project with a test suite and try running it. It should work.
Any way, the solution provided is a tested solution.
By the way, here is an improved version, to handle test steps that can't have an assertion such as Groovy Script, Properties steps
testSuite.testCaseList?.each { kase ->
kase.testStepList?.each {
if (it.metaClass.respondsTo(it, 'getAssertions')) it?.assertions['ConciseResponse']?.disabled = true
}
}
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It appears that there is a dot (.) missing before "each" or I shall visit an opthamologist.
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regards,
Rao.

- « Previous
-
- 1
- 2
- Next »
- « Previous
-
- 1
- 2
- Next »