Forum Discussion

AAB's avatar
AAB
Regular Contributor
6 years ago

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. ...
  • nmrao's avatar
    nmrao
    6 years ago

    AAB 

     

    Couple of things:

     

    To be able to use below groovy script, an external library is needed which can be downloaded from here and copied under READYAPI_HOME/bin/ext directory and restart the tool before running it.

     

    Define a custom property at Project level for the service host and post details

    Property name as SERVICE_HOST_PORT and value as http://localhost:8080 (or what ever)

     

    Now coming to each test case, you may want to send certain query and header parameters.

    Define custom properties at test case leve as shown below in the same notation (do not use angular brackets, just shown for separation). Also shown in the picture below.

    QUERY_<parametername> and its value

    HEADER_<parametername> and its value

     

    Define as many query and header parameters as needed for the specific test.

     

    That way, correct parameters can be identified and passed automatically under query, header sections respectively.

     

     

    And now in each test case, you will only have one Groovy Script test step with above content and only custom properties are changed.

     

    You can find the script in text format from my git

    https://github.com/nmrao/soapUIGroovyScripts/blob/master/groovy/rest/VaryingQueryAndHeadersToRestService.groovy

     

     

  • Nastya_Khovrina's avatar
    6 years ago

    About omitting the parameters...
    If a parameter with an empty value shouldn't be sent, you need to un-check the Required check-box for this parameter in the Advanced options section
     for this parameter.