0

I am trying to automate and measure the performance of an application and some use cases .The application launches the remote server through the VNC and do some user actions on the remote server. We are planning to use sikuli with python for this testing. I am very new to sikuli.

How can I measure the time of the user actions in sikuli? For example, Im clicking on a button in the screen of the remote server and another screen launches. How to measure this?

RJM
  • 271
  • 1
  • 5
  • 32

1 Answers1

0

I think you can do something like this start = time.time() is not a timer. it just stores the time at the moment this statement is processed into the value start. So later on all around the place, where you have access to the variable start, you can check the time, that elapsed since start: elapsed = time.time() - start

So without stepping into subprocessing or even event processing, you need a function that starts a new timer and can be asked, whether a given time has elapsed and a global storage for the timer values.

basic timer function:

def timer(name, elapse=0):
    if elapse > 0: # we start a timer
        exec("Settings.myTimer" + str(name) + "=time.time()+" + str(elapse)
    else # we check the timer
        rest = eval("Settings.myTimer" + str(name)) - time.time()
        if rest > 0: return False # not yet elapsed
        else return True

usage:
timer(1, 100) will start now and elapse in 100 seconds
# ... some code
if timer(1): print "timer1: time is over"

As global storage for the timer values I use the Sikuli Settings class.

Since the timer not really does anything, it is just storing a value for later comparison, you do not need a "reset".

just repeating the above sequence would give a new value to Settings.myTimer1
Godda
  • 951
  • 1
  • 10
  • 26