Forum Discussion
Radford
9 years agoSuper Contributor
The following Groovy script can be added to you TestSuite Setup Script:
// Loop through each test case and all of their test steps within the test suite.
// NOTE: getTestSteps() and getTestCases() return Maps with the name as the key and the actual case/step as the value.
testSuite.getTestCases().each() { teatCaseName, testCase ->
testCase.getTestSteps().each() { testStepName, testStep ->
// Check to see if current step implements the interface Assertable
if (testStep in com.eviware.soapui.model.testsuite.Assertable){
def assertionCount = testStep.getAssertionCount()
if(!assertionCount){
log.warn('The test step "' + testStep.getName() + '" in the test case "' + testCase.getName() + '" does not have any assertions!')
}
}
}
}
This will loop through all of your test cases and their test steps before the test suite is run, logging a warning message when it finds one without an assertion. This could easily be tweaked to do what you want.
Note: If you add this to your test suite Setup Script it will run every time you run your test suite, you will have to decide if this has a significant performance impact or not.
Edit: I see that conversation has occured as I was typing out a reply, and now there is a bit more information. you should be able to move the above script to the Project startup script, and then an add a test suite loop.
CByler
9 years agoContributor
Thank you! I appreciate the help :)