ContributionsMost RecentMost LikesSolutionsRe: How to make sure a Groovy script runs for every test step Can anyone please help? Re: How to make sure a Groovy script runs for every test step 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. Re: How to make sure a Groovy script runs for every test step 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. How to make sure a Groovy script runs for every test step Hi, How do I make sure that a particular Groovy script runs for every test step? Say I have a Tescase A with n number of steps and Groovy script is a test step part of Test case. And where should I add it inside the groovy script? Re: Assertions with conditions Yes for sure :) How do I make sure Groovy script runs for each test step? and where should I include in the script. For example say this is my testcase name Morph Replace - Phase1 and i have n number of steps inside this test case. Thanks, Udaya Re: Assertions with conditions Thanks so much.. it worked! Re: Assertions with conditions No worries :) Sorry +ve is positive and -ve is negative. Re: Assertions with conditions Hi , Here is what my sample response looks like: Below is the response returned by the REST request { "morphOnlyNetAmount" : -20.31---- (This value can be a +ve or -ve value) } The JDBC response will return a field <REFUNDABLE_AMOUNT> -- can return 0 or >0. Now I need to make sure if REFUNDABLE_AMOUNT value and morphOnlyNetAmount value are equal only if REFUNDABLE_AMOUNT returns a +ve integer(>0) So the Re: Assertions with conditions Hi Richie , Thanks for looking into my query. So here is my request: 1. REST request which will return a field A (+ve or -ve integer) as response 2. JDBC request that will return a response which has Order Total field (field B)-- can be 0 or +ve integer Now I need to make sure if field B value and field A value are equal only if field B returns a +ve integer(>0) Can you pls help me how to assert this? Assertions with conditions Hi, I am new to SOAP UI, I have a JDBC request which is a select query and it returns an XML response. JDBC request (say Request B)==> In response, there is a field, Order total which returns 0 or +ve interger based on response returned in the previous response(say REST request A) (which returns a +ve or -ve integer) So I want to check if the Order total(returned in request B) matches the response returned in request A only when reponse of A returns a +ve value. How can i acheive this assertion when I have a condition to be given? Thanks in advance, Udaya Solved