Forum Discussion

pankaj_nith's avatar
pankaj_nith
New Contributor
8 years ago

testRunner.results giving incorrect count for results

Hi,

 

This is my first post in the forum and am hoping its in accordance with the forum's norms.

I am using Ready API 2.2.0 and am facing this weird situation wherein I am getting incorrect number of results in the testRunner.results List when the number of test steps is greater than 5. 

 

As a sample test I have created a Empty project with one TestSuite with one TestCase with 7 Test Steps (all Groovy Scripts with no code inside, just blank script files) named Step1, Step2..., Step7. (same happens with  6 steps)

 

I am using this code to get the name and test step outcome in the TestCase's Tear Down script:

 

log.info "testRunner.results.size() = " + testRunner.results.size()
log.info "testRunner.resultCount = " + testRunner.resultCount

for(result in testRunner.results){
log.info "Name: " + result.testStep.name + " || " + "Result: " + result.status
}

and I get the following outcome in case there are 7 test steps:

 

 

Fri Nov 10 17:40:38 IST 2017:INFO:testRunner.results.size() = 5
Fri Nov 10 17:40:38 IST 2017:INFO:testRunner.resultCount = 7
Fri Nov 10 17:40:38 IST 2017:INFO:Name: Step3 || Result: OK
Fri Nov 10 17:40:38 IST 2017:INFO:Name: Step4 || Result: OK
Fri Nov 10 17:40:38 IST 2017:INFO:Name: Step5 || Result: OK
Fri Nov 10 17:40:38 IST 2017:INFO:Name: Step6 || Result: OK
Fri Nov 10 17:40:38 IST 2017:INFO:Name: Step7 || Result: OK

and when the number of test steps in the test case is 5, this is the output:

 

 

Fri Nov 10 17:42:19 IST 2017:INFO:testRunner.results.size() = 5
Fri Nov 10 17:42:19 IST 2017:INFO:testRunner.resultCount = 5
Fri Nov 10 17:42:19 IST 2017:INFO:Name: Step1 || Result: OK
Fri Nov 10 17:42:19 IST 2017:INFO:Name: Step2 || Result: OK
Fri Nov 10 17:42:19 IST 2017:INFO:Name: Step3 || Result: OK
Fri Nov 10 17:42:19 IST 2017:INFO:Name: Step4 || Result: OK
Fri Nov 10 17:42:19 IST 2017:INFO:Name: Step5 || Result: OK

with 6 steps, this is the output:

Fri Nov 10 17:44:19 IST 2017:INFO:testRunner.results.size() = 5
Fri Nov 10 17:44:19 IST 2017:INFO:testRunner.resultCount = 6
Fri Nov 10 17:44:19 IST 2017:INFO:Name: Step2 || Result: OK
Fri Nov 10 17:44:19 IST 2017:INFO:Name: Step3 || Result: OK
Fri Nov 10 17:44:19 IST 2017:INFO:Name: Step4 || Result: OK
Fri Nov 10 17:44:19 IST 2017:INFO:Name: Step5 || Result: OK
Fri Nov 10 17:44:19 IST 2017:INFO:Name: Step6 || Result: OK

The results list somehow seems to have only the last 5 results in it. Can someone throw some light on whether I am doing something wrong or if this looks like a bug?

Any thoughts are much appreciated.

 

Regards,

Pankaj

 

    • pankaj_nith's avatar
      pankaj_nith
      New Contributor

      Thanks Marcus! It indeed works.

      I am a little confused about this setting though. Why do we want to limit the number of results in the test case(for the current test run). Limiting the number of previous results to be stored in history makes sense to me but if in our current test case we have N number of steps why we would want to store only N-x results and not all the test step results.

      Another thing is what testRunner.results.size() and testRunner.resultCount are returning (they differ in case I exceed the number of test steps).

      Pardon me for not correctly understanding the case here. I appreciate all your inputs.

       

      All said, it solves my problem :-)

       

      Thanks,

      Pankaj