cancel
Showing results for 
Search instead for 
Did you mean: 

Groovy script query

SOLVED
Highlighted
Contributor

Groovy script query

I design 3 Groovy scripts as script-1,2 and 3.now I tried to call this all groovy script 1 by 1 in another script as script-4 i.e  -if first script is passed then switch/call to next script.how to design this approach(need script),is it possible?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super Contributor

If it is working fine. Could you please accept as a solution so that other users get benefited whenever they come accross?

View solution in original post

6 REPLIES 6
Highlighted
Super Contributor

You can try this code:-

 

tStep = tCase.getTestStepByName("script1")
def runner = tStep.run(testRunner, context)
if(runner.hasResponse()){
//Call another script like this
tStep1 = tCase.getTestStepByName("Script2")
def runner1 = tStep1.run(testRunner, context)
}

Hope, this helps you out. 

Highlighted
Moderator

Hi everyone,

 

Thank you so much for sharing the code, @avidCoder!

 

@amarnath1234, does it work for you, or do you have any additional details on the case?
If it does, don't hesitate to mark the reply with the code as a solution to this case. This makes the search for the answer easier in the future for other users.

We are looking forward to hearing from you Smiley Happy

 

 


Olga Terentieva
SmartBear Assistant Community Manager

Highlighted
Contributor

this is not working, i got error.

Highlighted
Super Contributor

Could you please elaborate it properly that what kind of error you are getting and also if you could share the picece of code you have used?

Highlighted
Contributor

this is working fine,Thanks.

Highlighted
Super Contributor

If it is working fine. Could you please accept as a solution so that other users get benefited whenever they come accross?

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements
TechCorner Leaderboard
Want a fun and easy way to learn ReadyAPI and show off your skills? Try solving weekly TechCorner challenges and get into the Leaderboard!


Challenge Status

Get a full Raw JMS request

Participate!

Compare an expected JSON value and actual response in Events

Participate!

Fetch value/data from JSON response using Groovy Script

See replies!

Get data from Petstore and add it to Excel sheets

Participate!
Top Kudoed Authors