Forum Discussion
hi ,
Adding some scripts to get the test status results in the log ,
hope it help.
// get the testStep
/*def testStep = testRunner.testCase.getTestStepByName('householdGet')
// print assertion names an its status
testStep.getAssertionList().each
{
log.info "$it.label - $it.status"
}*/
//---------------------------------------
def soapStep = testRunner.testCase.testSteps["householdGet"]
for( assertion in soapStep.assertionList )
{
log.info "Assertion [" + assertion.label + "] has status [" + assertion.status + "]"
for( e in assertion.errors )
log.info "-> Error [" + e.message + "]"
}
//---------------------------
def responseStatus
def listOfAssertions = testRunner.getTestCase().getTestStepByName("householdGet").getAssertionList()
for (assertion in listOfAssertions)
{
// You can get the status of any assertions and here I am getting the value for NotSoapFaultAssertion
if (assertion instanceof com.eviware.soapui.impl.wsdl.teststeps.assertions.soap.NotSoapFaultAssertion)
responseStatus= assertion.getStatus()
responseStatus = responseStatus.toString()
}
log.info "responseStatus is : $responseStatus"
if (responseStatus == "VALID")
{
log.info "Proceed To Validation"
}
else {
log.info "Skip Validation"
}
Hi
Thanks for the solution but I want to save the status of each step in db.How this can be done.Please help
- mishka10 years agoNew Contributor
hi ,
I dont know how to save it in DB never tried it , but you can save it in TXT files ,
If you will do simple looping on the response and refer it to the TXT file ,
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;File file = new File("C:/Users/Desktop/[folder name]/file name --> it can be varible.txt"); //it will create the file
FileWriter fw = new FileWriter(file.getAbsoluteFile());
BufferedWriter bw = new BufferedWriter(fw);bw.write([your value] + System.lineSeparator());//new line
bw.close();//close the write to the file
hope it helped.:)