cancel
Showing results for 
Search instead for 
Did you mean: 

How to add Query and Header parameter to REST request using groovy script in SoapUI?

Highlighted
New Contributor

How to add Query and Header parameter to REST request using groovy script in SoapUI?

I'm new to Groovy scripting. I want to add Query (Style: QUERY, Level: RESOURCE) parameter and header (Style: HEADER, Level: METHOD) parameter as shown in below snap and want to select the Media-Type as "multipart/form-data" and also want to check the checkbox for "Post QueryString". How can I write groovy script to achieve above things?

I can't do it manually because of the automation framework that I'm using. I have single POST method for all my test cases (say e.g. for 25 test cases) and have to add or remove Query/header parameters depending on the requirement.SoapUI_Query_Header_Parameter.png

2 REPLIES 2
Highlighted
New Contributor

Re: How to add Query and Header parameter to REST request using groovy script in SoapUI?

I got below script to set Media type to multipart/form-data.

 

 testRunner.testCase.testSteps["POST_Equipment"].httpRequest.setMediaType("multipart/form-data");

Highlighted
Community Hero

Re: How to add Query and Header parameter to REST request using groovy script in SoapUI?

Not sure how the 2nd message related.

Can you check below thread
https://community.smartbear.com/t5/ReadyAPI-Feature-Requests/Ability-to-parameterize-REST-API-Parame...


Regards,
Rao.
New Here?
Join us and watch the welcome video:
Top Kudoed Authors