Hi,
I am using Marathon 2.0b4 to automate tests for an application.
A shortcoming of wait_p
, one of the script elements provided by Marathon, is that its default timeout is hardcoded to be 60 seconds. I needed a larger timeout due to the long loading times in my application.
[I considered patching Marathon, but didn't want to maintain parallel versions etc., so figured that a better solution would actually be a workaround at the test script level.]
def wait_p_long(times, compID_name, ppty_name, ppty_value, compID_cell=None):
from marathon.playback import *
"""Wrapper around wait_p which takes exactly the same parameters as wait_p,
except that an extra first parameter is used to specify the number of times
wait_p is called"""
for i in range(1, times):
try:
wait_p(compID_name, ppty_name, ppty_value, compID_cell)
except:
if (i < times):
print "wait_p failed, trying again"
else:
raise
wait_p
is short for "wait property", and it takes in 3 compulsory and one optional argument (the argument's names are rather self-explanatory), and what it does is wait for a speicifed property of the specified component to be equals to the specified value.
What the above method (Jython) intends to do is take one extra parameter, times
, which specifies the number of times to attempt wait_p
, suppressing the exceptions up until the last try.
However, this method isn't working for me, and I am afraid there might be some syntactical or logical error somewhere in there. Any comments from python / jython gurus out there?
Thanks!