Forum Discussion

axeltoushirou's avatar
7 years ago

Modifying REST request query via groovy script

anyone tried to modify request query via groovy script?

i am trying to pass empty data to query, and still gets rendered to the final request url.

3 Replies

    • axeltoushirou's avatar

      i found a way to modify the request of a teststep using a groovy script



      def testStep = context.testCase.getTestStepByName('My test step name')
      for (def testCaseProp in testStep.getPropertyList()) {



      but, is there a better way? I want to modify the request queries of other teststeps.

      • PaulMS's avatar
        Super Contributor

        You have an optional query parameter that should not be in the request URL if blank?

        Was the parameter set as required in the method viewer?


        In many requests you can set the parameter value to equal a property like ${#TestCase#PropertyName}

        Then you can change the test case property to update all those tests.