Forum Discussion

larryx's avatar
larryx
Frequent Contributor
11 years ago

[R]SoapUI load test - ${ThreadIndex} in a property-expansion

Hello,
From http://www.soapui.org/Load-Testing/loadtest-scripting.html, it says below:
"LoadTest related properties in TestCase scripts
When a TestCase is run under a LoadTest, certain properties are made available in the TestCases context object which can be useful during scripting;
•context.ThreadIndex - contains the 0-based index of the current thread, so if you use ${ThreadIndex} in a property-expansion, that value will be unique to each thread running under the LoadTest."
I need to know how to get value of ${ThreadIndex} and/or where is property-expansion? Please Help Me!
Thanks,
Larry

3 Replies

  • This doesn't directly answer your question, but this workaround might help you:

    Try inserting a "DataGen" Test Step at the start of your TestCase. Create a variable called something like "index".
    Type = "Number"
    Mode = "Step"
    Shared = true
    Start = 0
    Step = 1

    This will create a variable that will increment by 1 for each thread, thus giving each thread a unique index of sorts.
    It can be accessed by: ${DataGen#index}
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi Larry,

    You can read here on using property expansion in SoapUI Pro: http://www.soapui.org/Scripting-Propert ... nsion.html
    I also recommend this article and video tutorial: http://www.soapui.org/Working-with-soap ... sting.html

    Since the ThreadIndex is a built-in value, it can be used directly during a LoadTest. What EBaethke has suggested is another way to generate yourself an index for the threads in your LoadTest.

    Regards,

    Giscard
    SmartBear Support
  • larryx's avatar
    larryx
    Frequent Contributor
    Hi EBaethke/Giscard,
    Thanks a lot for the alternative solution and valuable resource. My issue was solved.
    Thanks,
    Larry