In one of the blog post, somebody asked me how they can get the status of each individual assertion of a test step. So on my way to office, i managed to comeup with below is the script which will extend (rather append) the existing code written in blog post - "Groovy 6 - clone test step assertion using Groovy script in soapUI".
Please note, that the below provided script can be extended/merged with other script shared. For instance, you can place few code lines from the script and iterate through all the teststep inside a testcase.
Keeping watching/reading this space, soon i will be sharing the blogs on - communicating with JXL API (free Excel API) & interaction with database using the Groovy.
Please note, that the below provided script can be extended/merged with other script shared. For instance, you can place few code lines from the script and iterate through all the teststep inside a testcase.
Keeping watching/reading this space, soon i will be sharing the blogs on - communicating with JXL API (free Excel API) & interaction with database using the Groovy.
/*
@Title : Gr-ooooooo-vy VII
@Title : Gr-ooooooo-vy VII
@Author : Pradeep Bishnoi
@Description : Get the status of each assertion inside a specific test step.
*/
import com.eviware.soapui.model.testsuite.Assertable
def project = context.testCase.testSuite.project
def testSuite = project.getTestSuiteAt(1)
def testCase = testSuite.getTestCaseAt(0)
def testStepSrc = testCase.getTestStepByName("myTestStepName")
def counter = testStepSrc.getAssertionList().size()
for (count in 0..<counter)
{
log.info("Assertion :" + testStepSrc.getAssertionAt(count).getName() + " :: " + testStepSrc.getAssertionAt(count).getStatus())
error = testStepSrc.getAssertionAt(count).getErrors()
if (error != null)
{
log.info(error[0].getMessage())
}
log.info("---------------------------- Line to seperate each assertion status in logs -----------------")
}
I would appreciate your valuable comments and other relevant inputs. Keep sharing & be happy :-)
I would appreciate your valuable comments and other relevant inputs. Keep sharing & be happy :-)