Forum Discussion

mgroen2's avatar
mgroen2
Super Contributor
7 years ago

transfer result of a Groovy script to HTTP script

I have following question:

I created a JDBC request, and a Groovy script.
In the Groovy Script, in field Custom Properties, the property with name "result" contains the result (87654322 in this case).

Now I want this value (87654322) to be transferred to the following HTTP request.

So that the HTTP request would be like:

http://xxxxxx.com/87654322

Question:
How can I transfer the result of the Groovy script to the HTTP script?

attached is the exported project.

 

  • avidCoder's avatar
    avidCoder
    Super Contributor

    You can create a Properties variable as VALUE and store this 87654322 to value using this code:-

     

    testRunner.testCase.testSuite.project. setPropertyValue(“VALUE”, value)

    And after this create groovy script where you call the URL - http://xxxxxx.com/ and append the VALUE using java code (i.e def URL) and create one more Properties step and name it as URL, then set URL using this code:-

    testRunner.testCase.properties['URL'].setValue(URL)

    Now in the address path  just mention this code:-

    ${#Properties#URL}

    Hope this helps you out.

     

     

    • Olga_T's avatar
      Olga_T
      SmartBear Alumni (Retired)

      Hi all,

       

      Thank you for your suggestion, avidCoder!

       

      mgroen2, have you had a chance to follow the above instructions on your side? Is your question answered, or, do you have any additional information for us here?
      We are looking forward to hearing from you.