cancel
Showing results for 
Search instead for 
Did you mean: 

Groovy/scripts: How to call test case and how to send REST request

SOLVED
Highlighted
New Contributor

Groovy/scripts: How to call test case and how to send REST request

Hi there! 

I have two questions about soapUI Pro scripting (using now v5.1):

 

1) I trying to launch test case from another test case / mock, but got error 

 

Wed Mar 04 11:52:38 MSK 2020:INFO:Error: groovy.lang.MissingMethodException: No signature of method
Script1.$() is applicable for argument types: (Script1$_run_closure1) values: [Script1$_run_closure1@40aa66fd]
Possible solutions: is(java.lang.Object), run(), run(), any(), use([Ljava.lang.Object;), any(groovy.lang.Closure)

Code:

 

 

log.info('Started')
def currentProject = testRunner.getTestCase().testSuite.getProject();
def theTestCase = currentProject.getTestSuiteByName("TS").getTestCaseByName("TC_send_req");
log.info('Test case: '+theTestCase.getName());

def properties = new com.eviware.soapui.support.types.StringToObjectMap();
def async=false;

 def runner = theTestCase.run(
 	properties,
 	async
 );

log.info('Status: '+runner.status.toString());

if( runner.status.toString() == "FINISHED" ) log.info('Done!');
else log.info("Error: " + runner.reason);

Please help me to fix it, spent hours but no luck

 

 

2) Can i form and send REST request manually? In guide i found this 

request.submit( new com.eviware.soapui.impl.wsdl.WsdlSubmitContext( request ), false )

It's worked for me, but it's SOAP request, and i need to send REST. 

Tried to make test case, add REST request (with endpoint already setted) and call it from groovy, but failed (see question 1).

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Leader

Re: Groovy/scripts: How to call test case and how to send REST request

@pyrinoff 

 

Hope below link will help to pass rest request.

 

https://support.smartbear.com/readyapi/apidocs/soapui/com/eviware/soapui/impl/rest/class-use/RestReq...

 


Click "Accept as Solution" if my answer has helped, and remember to give "kudos" 🙂 ↓↓↓↓↓



Thanks and Regards,
Himanshu Tayal

View solution in original post

4 REPLIES 4
Highlighted
New Contributor

Re: Groovy/scripts: How to call test case and how to send REST request

Something wrong was with my TC. I create new TC and it's runned ok! 

Only #2 relevant

Highlighted
Community Hero

Re: Groovy/scripts: How to call test case and how to send REST request

You mean, still looking for solution for #2 one?

If so, please elaborate the use case?
And what is the output of below statement (write this before above statement)
log.info request.getClass()


Regards,
Rao.
Highlighted
Community Leader

Re: Groovy/scripts: How to call test case and how to send REST request

@pyrinoff 

 

Hope below link will help to pass rest request.

 

https://support.smartbear.com/readyapi/apidocs/soapui/com/eviware/soapui/impl/rest/class-use/RestReq...

 


Click "Accept as Solution" if my answer has helped, and remember to give "kudos" 🙂 ↓↓↓↓↓



Thanks and Regards,
Himanshu Tayal

View solution in original post

Highlighted
Community Manager

Re: Groovy/scripts: How to call test case and how to send REST request

Thank you for helping nmrao, HimanshuTayal!

 

Hi @pyrinoff, please let us know if the Community was able to help you. Or, if you still require our assistanceSmiley Happy 


Sonya Mihaljova
Community and Education Specialist

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
New Here?
Join us and watch the welcome video:
Announcements
TechCorner Leaderboard
Compete with community members in the TechCorner Challenge and get into the Leaderboard!

Rank Participant Points Earned
1 msiadak 12
2 nmrao 8
3 HimanshuTayal 3
Top Kudoed Authors