app自动化测试之实战应用(魅族计算器)

模拟魅族计算器加法计算:

 

from appium import webdriver

desired_caps = {}
desired_caps['deviceName'] = '621QECQ23DKQP'
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '6.0'
desired_caps['appPackage'] = 'com.meizu.flyme.calculator'
desired_caps['appActivity'] = '.Calculator'
desired_caps['unicodeKeyboard'] = 'True'
desired_caps['resetKeyboard'] = 'True'

driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub',desired_caps)
driver.find_element_by_name('C').click()
driver.find_element_by_name('5').click()
driver.find_element_by_name('2').click()
driver.find_element_by_name('+').click()
driver.find_element_by_name('4').click()
driver.find_element_by_id('com.meizu.flyme.calculator:id/eq').click()

driver.quit()

 

这个是最简单的,如果是真的做自动化测试,需要做断言、数据读取、多种计算方法等都需要测试到。在在实际应用中并非这么简单

 

posted @ 2018-06-23 18:32  水里的芋头  阅读(624)  评论(0编辑  收藏  举报