Forum Discussion

Beasty337's avatar
Beasty337
New Contributor
14 years ago

Hi guys, I need help on Property Transfer Test Steps!

Hi everyone,

Just before explaining my problem, I just want to inform you that my English is not my first language. Sorry if my thoughts are hard to follow =).

OK, I'm working on a project in SoapUI 4.5 for 2 weeks. In one of my functional testing, my first step is to perform a GET method. By doing that, my system in test return to SoapUI a hexadecimal code. I need to export this code to another Test Step.

In XML format, it return something like : <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">722a6f83-d583-4268-8401-732fc6ea1666</string>
In this case, my problem is when I want to transfer this code to another test step, the property transfer action always transfer all xml line. I cannot have only the hexadecimal code.

In JSON format, it return the hexadecimal code but with '' ".
In this case, my problem is when I want to transfer this code to another test step, the property transfer action also include '' ''.

The result of these problem is when I want to use this code in a further test step, hexadecimal number is not recognized.


So, whatever format choose, is there a way to exclude '' '' or the .xml line and only import my hexadecimal code to another test step?

Thank you and sorry again for my bad english.

3 Replies

  • balak84's avatar
    balak84
    Occasional Contributor
    Hi,

    If it is the value "722a6f83-d583-4268-8401-732fc6ea1666" that you want to transfer to a Test request , then you can capture this using a Groovy script say "GS1"

    Once you have this value captured then you can return the value from the Groovy script using << Return variable >>. This will return the value from the Groovy script.

    ex:

    Say you have captured "722a6f83-d583-4268-8401-732fc6ea1666" in a variable "var1". Then,

    var1 = 722a6f83-d583-4268-8401-732fc6ea1666

    So,

    return var1 will return 722a6f83-d583-4268-8401-732fc6ea1666.

    Now, use the Property Transfer step and define a Transfer variable inside it.

    For the Transfer variable,

    Source: GS1 ==> Groovy Script
    Property: result (can be selected from the drop down)

    Target: Test Request step to which the value has to be transferred
    Property: Property within the Test request where the transferred value has to land (for this the Property should be defined as a pre requisite within the Test Request)

    Also, in case when you get the value << 722a6f83-d583-4268-8401-732fc6ea1666 >> if you have the value coming as << "722a6f83-d583-4268-8401-732fc6ea1666" >> then in the same groovy use the "split" logic and have the << " " >> removed. Post that you can rerun the variable from the same groovy step as mentioned earlier in this post.

    Hope this helps!!!

    Regards.
  • prx187's avatar
    prx187
    New Contributor
    Is it possible to find these variable from a testStep request with an expression like ${MyPreviousStep#Response#ID} ?

    My previous test step returns a (raw) response like "ID:922a6f83-d583-4268-8401-732fc6ea1666"
  • tjdurden's avatar
    tjdurden
    Frequent Contributor
    Hi prx187,

    I don't understand why you're not able to isolate the value using XPath. Are you able to paste a large chunk of the XML that contains the element/node value you want to transfer please?

    Kind regards,
    Tim