Forum Discussion

Dominique's avatar
Dominique
Occasional Contributor
16 years ago

newbie: properties don't work + how to use Groovy scripts?

Good afternoon,
I am new in SOAPUI and I have the following situation:

I have a lot of requests, containing the following variables:
%%CLIENT_ID%%
%%REF_ID%%

(the values with the '%%' signs are imported from an external file.)

In order to fill in the values of the mentioned variables, I have made the following replacements for each request:
12345
265

I have decided to work in this way because "Test Properties" did not work well: I had filled in the test properties as follows (on test suite level):
%%CLIENT_ID%%  :  12345
%%REF_ID%%  :  265
but when I ran the request, the values %%CLIENT_ID%% and %%REF_ID%% were not replaced by 12345 and 265.

Now, I have the following problem: I would like to use the following variable:
%%TIMEOUT_30SEC%%

where TIMEOUT_30SEC should equal the current date/time + 30 seconds.

In order to do this, I need a groovy script in order to calculate this value, but as the examples on the website explain how to change a property of a testcase, I also need to know how to use the properties of Test Cases.

Can anybody help me?
Thanks
Dominique

4 Replies

  • Dominique's avatar
    Dominique
    Occasional Contributor
    Thanks Sachin,
    However I think my question is not clear:
    I have test suites that contain test cases. Each of those test cases contain test steps that contain SOAP requests that look like the following:
    ...
    %%REF_ID%%
    ...

    and I would like to have a way to say:
    for every test step in each test case of this test suite, if I launch a SOAP request that contains the mentioned "%%REF_ID%%", then replace it automatically by 265 and send SOAP requests that look like the following:
    ...
    265
    ...

    Is this possible in SOAPUI without programming, just by configuring?
    Thanks
    Dominique
  • Dominique's avatar
    Dominique
    Occasional Contributor
    Hello,
    I have just found part of the solution:
    - I add a property to my testsuite (%%REF_ID%%=265).
    - just before each test step, I add a "property transfer", transferring the test suite property %%REF_ID%% towards the test step containing the SOAP request, and as location, I specify "//ref_id".

    The problem that I have now is that within my SOAP request, the value %%REF_ID%% has been replaced by 265, which means that I cannot use another value for %%REF_ID%% anymore.

    Does anybody have any idea?
    Thanks
    Dominique
  • Dominique's avatar
    Dominique
    Occasional Contributor
    hello all,
    I have found a way to solve this issue. Hereby this post can be closed.

    Kind regards
    Dominique