Forum Discussion

camarar's avatar
camarar
Occasional Contributor
9 years ago

LoadTest

I use soapUI 4.5.1.
I have a TestSuite with 4 steps, see below, and a Load Test.
Now I will say what each TestStep do in this context.
- Properties; I create one variable "number" and set a value ( eg: 100);
- Groovy Script : I increment this variable with (+1) and set the new value;
- Property Transfer : I transfer the value from variable "number" and put on element in XML inside the Request.

My goal it is run the LoadTest "LoadTest-Request" and check the time for each request on interval of 60 seconds.

 

 

 

My problem it is that each request don't update with the new value executed on Step "Property Transfer".

 

 

  • Hi,

     

    It seems you are setting the property against a property TestStep, can you try setting it against the TestCase instead e.g.

     

    //set it with
    testRunner.testCase.setPropertyValue("numberprop", String.
           valueOf(number))
    
    //can get it with
    def number = Integer.parseInt(context.expand('${#TestCase#numberprop}'))
    
    

    ?

    OK, one thread - I think it still creates a clone of the TestCase, has been a while since I tried it. 

     

    Regards,

    Rupert

  • rupert_anderson's avatar
    rupert_anderson
    Valued Contributor

    Hi,

     

    What is the scope of the property or variable you are trying to increment in your GroovyScript TestStep?

     

    With load tests it is important to bear in mind that the load runner will create a (or multiple when threaded) clone(s) of your TestCase when running, following completion of the TestCase, the the context of that TestCase (and any properties stored on it) will be lost and a new context will be created for the next run. You could consider storing your counter at TestCase, TestSuite or project level, but be mindful when doing this if you run your load test with multipe threads, as you can get wierd concurrency issues depending on the type of property and how you update it e.g. a TestSuite level property would be shared between muliple threaded load test runners.

     

    Hope this make some sense,

    Regards,

    Rup

    • camarar's avatar
      camarar
      Occasional Contributor

      Thanks all.
      I don't know how identify the scope of my property "number" and because this I will show the complete scenery of this Load Test.


      Now about Load Runner, When I use only 1 thread in my loadtest it is create a clone(s) of my TestCase when running ?

      • rupert_anderson's avatar
        rupert_anderson
        Valued Contributor

        Hi,

         

        It seems you are setting the property against a property TestStep, can you try setting it against the TestCase instead e.g.

         

        //set it with
        testRunner.testCase.setPropertyValue("numberprop", String.
               valueOf(number))
        
        //can get it with
        def number = Integer.parseInt(context.expand('${#TestCase#numberprop}'))
        
        

        ?

        OK, one thread - I think it still creates a clone of the TestCase, has been a while since I tried it. 

         

        Regards,

        Rupert