i have multiple test cases, have respective monkeyrunner scripts. thing fidn monkeyrunner in case becomes device dependant, record coordintes sequence of events. have major issues when work, not same device test, result end making scripts each device lot of re-work. new python, wondering if there way can keep coordinates in separtate file , script generic, in can create multiple coordinate files run same python code. how that
print "initiating calling process" device1.touch(688,1620,'down_and_up') monkeyrunner.sleep(4) #dialer print "opening dialer" device1.touch(536,1694,'down_and_up') monkeyrunner.sleep(2) device1.touch(526,664,'down_and_up') monkeyrunner.sleep(4) device1.type(ph_nmber_1) #device 1 calling print "calling device 1" device1.touch(536,1562,'down_and_up') monkeyrunner.sleep(4) device1.touch(536,1562,'down_and_up') monkeyrunner.sleep(8) for example above code particular device coordinates according device how can remove hard coding of coordinates?
one of many reasons androidviewclient/culebra exist precisely solve problem mentioned. unit tests , scripts generated these tools device-independent biggest possible extent.
for example, if content description available you'll have like
vc.findviewwithcontentdescriptionorraise(u'''story album''').touch() if text available instead, you'll have
self.vc.findviewwithtextorraise(u'create new contact').touch() otherwise, ids used
self.vc.findviewbyidorraise("com.samsung.android.app.episodes:id/timeline_add_album_layout").touch() this video illustrates feature running same test on phone , tablet: http://dtmilano.blogspot.ca/2014/11/culebra-cross-device-application-tests.html
Comments
Post a Comment