Forum Discussion

tientran's avatar
tientran
Occasional Contributor
8 years ago

I have a string "1234" in response , how can I get the value 1234 from "1234" ?

I have a string "1234" in response in step 1, how can I get the value 1234 from "1234" for using in step 2 ? Please help me.

 

Thanks Guys.

3 Replies

  • Radford's avatar
    Radford
    Super Contributor

    There are two simple out-of-the-box methods. You can either:

     

    1. Put a Property Transfer test step between your two test steps and configure appropriate to your needs.
    2. Use the Point and Click Get Data functionality.

    Reading you question literally, if you actually want to extract the value from within the two double quotes, if you use a property transfer step, you can use an XPath functions on the source that manipulates the data, something like:

     

    substring( <Your Xpath to Data> , 2, string-length(<Your Xpath to Data>) - 2)

  • nmrao's avatar
    nmrao
    Champion Level 3
    Please follow Radford instructions. If you still have trouble, show your response.
    • JustinM89's avatar
      JustinM89
      Contributor

      If you need an actual number instead of a string, put a Groovy test step in between and do a toInteger() on it