Ask a Question

How to omit parameters in a REST request

SOLVED
AAB
Regular Contributor

How to omit parameters in a REST request

Hi,

For my automation project I will have a lot of testsuites and testcases with a lot of combinations. For each testsuite I've entered the necessary parameters to be able to use in each testcase. In ReadyAPI you do that in tab "Projects" on your created webservice.

Now, not all parameters will be filled in for a particular testcase whereas the REST request will send anyways all the parameters as emtpy string.

For this project this is harmful, as an empty string could give an answer, and that isn't what I'm looking for.

For example:

Testsuite parameters: name, cbe_number, country, municipality, neighbours, street, housenumber, po_box

Testcase: Search company on name

For this testcase only parameter 'name' will be filled in, but when I send the request, all other parameters are also filled in in the URL. How can I, per testcase, omit the other parameters please?

Thanks in advance.

43 REPLIES 43
nmrao
Community Hero

First get it working, later you can look for the way to convert into library script.
Please show screen shot of your test case with custom properties?



Regards,
Rao.
AAB
Regular Contributor

Ok, here is the screenshot but the response is not complete and I can't copy it:

 

errormessage.png

 

and in attachement the error message after debugging.

nmrao
Community Hero

Have you placed the jar file from the link provided in earlier reply? And restarted the tool?


Regards,
Rao.
nmrao
Community Hero

Please defined the custom properties for the test case level not at the groovy script test step level.


Regards,
Rao.
AAB
Regular Contributor

@nmrao yes

 

jarInbin.png

nmrao
Community Hero

The error posted will be thrown only when the tool is not started then.


Regards,
Rao.
AAB
Regular Contributor

@nmrao 

my bet, I've added the parameters on testcase level. Furthermore, I've re-restarted ReadyAPI one more time. I've added a new webservice, deleted the old one and added new request to the testcases without parameters pre-configured

 

parametersTC.pngparametersTC2.pngI still got the error message...?

nmrao
Community Hero

Looks you are confused.

Earlier you showed a screen shot copying jar file under Open source directory. Now showing ReadyAPI where the script is copied.

Please go thru the earlier posts one more time.


Regards,
Rao.
AAB
Regular Contributor

ooh ok, I know what you mean. I've copied the jar in the "Program Files (x86)" instead of "Program Files" itself.

 

Ok done and restarted ReadyAPI. Another error message occurs:

"Groovy.lang.MissingPropertyException: No such property: headers for class:Script1

erro at line: 20"

nmrao
Community Hero

Please take the script from git again. Fixed it.


Regards,
Rao.
cancel
Showing results for 
Search instead for 
Did you mean: