Forum Discussion

StevenC's avatar
StevenC
Contributor
9 years ago

testcase.setPropertyValue is not updating the value between iterations of a loop using SoapUI 5.0.0,

In the following code...

def getStats = postProc.testSteps["getStatsForRun"]
runList.each{
    sleep (4000)
    log.info "getting stats for run: runName = ${it.runName}, runId = ${it.runId}"	
    postProc.setPropertyValue("runName", it.runName)
    postProc.setPropertyValue("runId", it.runId)
    log.info "runName = ${postProc.getPropertyValue("runName")} , runId = ${postProc.getPropertyValue("runId")}"
    sleep (4000)
    getStats = postProc.testSteps["getStatsForRun"]
    getStats.run(testRunner, context)  
}

The values of the properties runName and runId are only being updated on the first iteration of the loop. I can see in the logging that the list is being properly iterated but every time the getStatsForRun step is executed it uses the values of the first element in the list.

Is this a known issue in 5.0.0? If so is it resolved in the latest version of readyAPI?

5 Replies

    • StevenC's avatar
      StevenC
      Contributor

      A testcase...

       

       

      def postProc = testRunner.testCase.testSuite.project.testSuites[suiteName].testCases["postProcessingScripts"]
    • StevenC's avatar
      StevenC
      Contributor

      To give some background.


      This is a groovy script that controls a load test. You define a run duration (in either total seconds or an end time) and a number of test runs and the script will run through the number of defined test runs, then stop and restart the test. After the test duration has elapsed it executes some post processing scripts, in this particular case there is just 1 to be executed and all it does is query the results from out of the database and writes them to a spreadsheet but in other cases there could be other post processing (such as downloading log files from the tomcat servers and parsing them for information) .

      The reason why I have it break up the test runs into defined chunks is so that the results of a 4 hour test with more than 200,000 iterations of the test can be easier processed and represented into graphical format in excel (and the 64,000 row limit in excel is an issue too) .

      What this is trying to do is to iterate over the test runs and run the getStats script for each of them, the problem is it looks like the values of the properties of that testcase get loaded into the context and never updated even though the script is updating them.

    • StevenC's avatar
      StevenC
      Contributor

      I just verified the same issue occurs in both ReadyAPI 1.4.1 and 1.5

      • jsreesoap's avatar
        jsreesoap
        Contributor

        I had similar issue calling properties if other project. When I executed my script it did not pick up the lates values instead it was having previous run values. Support suggested to add project.save() in teardown script tab of the target project. Suppose I am calling properties of project A from project B, have project.save() in project A. I think the teardown or teardown script tab is in project properties. I use Ready Api.