Forum Discussion
Hi,
Thanks again. Below is a sample of my test case.
Test case name
Sku
soapreq1
soapreq2
Restreq1--returns the morphonly amt ( can be a +ve value or -ve value)
soapre3--- where the Order total value in the groovy script is asserted
RestReq2
JDBCreq1
JDBCreq2
Groovy script
Datasink
Datasourceloop
Groovy script:
Get the morphonly amount from restreq1
def morphOnlyrestResponse = getdata
//Get the total amount from soapre1
def searchOrdersoapresponse = getdata
def ordertotal = new JsonSlurper().parseText(searchOrdersoapresponse);
log.info("ordertotal = "+ordertotal);
def morphonly = new JsonSlurper().parseText(morphOnlyrestResponse);
log.info("morphonly = "+morphonly);
if (ordertotal > 0)
{
assert (ordertotal == morphonly)
log.info("Assertion positive Pass");
}
Questions:
So I want to make sure the above groovy script runs for every row in the Sku(data sheet). And my assumtion is if the order total is 0, then the groovy script will still execute as a test step?
I tried including def tc = testRunner.testCase.testSteps in my groovy script in the beginning. But when the order total was 0. i checkeed in the trasaction log, TestStepResult: Step[Groovy script] ran with assertion status [PASS]. Not sure if this is a correct way of doing it? Please advice.
Can anyone please help?