I am getting inconsistent results with this simple piece of QTP code. My objective here is verify approximate response time of a certain traction.
I am using the in-built mercury timer. Please see the code below.
1. I am clicking a submit button on a page
2. starting the timer.
3. Then I am waiting for the result page to load. I have a browser synch and a checkpoint to make sure that the expected page loads.
4. Then I stop the timer
5. Since the time captures in milliseconds, I am converting to seconds and displaying the results.
This transaction takes about 2 to 3 seconds on an average, but results always comes back and reports response time of less than 1 second, so I get results like - 0.14, 0.27, 0.09 and so on which is very unrealistic page load time.
Can someone help me figure out what I am doing wrong.
Timeout settings are set as follows
Test Browser sync timeout - 10 secs
Checkpoint timeout - 5 secs.
I am pulling my hair out now.. so I am sure a different set of eyes will expose the issue here. Thanks for your help in advance.
You should start timer before click.
Click itself doesn't take time at all, but right after click application starts page loading. Your timer will not be activated until application ends its thread.
Meanning: timer can not accomplish its task. It counts practically nothing. Sync doesn't take time also if page is here already.
So, try to switch those lines.