How to use the AutoIT to benchmark?

1 post in this topic

Guest derekliang

I am just wondering if anyone had tried to use AutoIT to benchmark application.

I have a GUI application needs to be benchmarked. The benchmark consists of about 50 steps. Because of the network/server load, there are steps might take up to 30 seconds to finish. Here is what it pseudo code looks like:

# 1. get the current time

# 2. send key commands and do some work

....

# 3. wait

# 4. repeat 2 step until all steps finish

# 5. calculate the time spend

Here is the problem. If I wait pre-determined time in step 3, the script will be finished and give same exact result each time. And also it will not work if I send all the key strokes to the application because either some dialog boxes are not opened yet or keys get missing for some reasons. So how do I detect if a GUI application ready to accept input.

;the following code to time how long it takes for Windows explorer
;to list all the directory on a remote server
Run("c:\windows\explorer.exe", "", @SW_MAXIMIZE)
sleep(1000)
$begin = TimerInit()
send ("{LEFT}{DOWN}{RIGHT}")
;list p drive content
send("p")
;What should I insert here to make sure the directory listing is completed?
;I know MouseGetCursor ( ) will work but not in my case, because the mouse cursor will change a couple of times in our application.
;My thought is that if I can exam a window input message queue throught Windows API, things might work here
$dif = TimerDiff($begin)