import unittest
import HTMLTestRunner
import time
from appium import webdriver
class fangdongliqi(unittest.TestCase):
u'''测试我模块'''
def setUp(self):
desired_caps={}
desired_caps['platformName']='Android'
desired_caps['platformVersion'] = '6.0'
desired_caps['deviceName'] = '7ec9d41c'
desired_caps['appPackage'] = 'prancent.project.rentalhouse.app'
desired_caps['appActivity'] = '.activity.WelComeActivity'
desired_caps['unicodeKeyboard'] = True
desired_caps['resetKeyboard'] = True
self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
time.sleep(2)
'''
self.driver.find_element_by_id("activity_login_user_edt").clear()
self.driver.find_element_by_id("activity_login_user_edt").send_keys(u'lushans@163.com')
self.driver.find_element_by_id("activity_login_password_edt").send_keys(u'111111')
self.driver.find_element_by_id("activity_login_center_btn").click()
'''
self.driver.implicitly_wait(5)
def tearDown(self):
self.driver.quit()
def test_a_personal(self):
u'''测试个人信息'''
print ('\n'+u'1.设置头像')
self.driver.find_element_by_id("iv_barme").click()
self.driver.find_element_by_id("iv_user_head").click()
self.driver.find_element_by_name("头像").click()
self.driver.find_element_by_name("拍照").click()
self.driver.find_element_by_id("com.zte.camera:id/photo_shutter_button").click()
self.driver.find_element_by_id("com.zte.camera:id/attach_photo_cancel").click()
self.driver.find_element_by_name("头像").click()
self.driver.find_element_by_name("拍照").click()
self.driver.find_element_by_id("com.zte.camera:id/photo_shutter_button").click()
if __name__=="__main__":
suit=unittest.TestSuite()
suit.addTest(fangdongliqi("test_a_personal"))
with open('testrepot.html','wb')as f:
runner = HTMLTestRunner.HTMLTestRunner(stream=f,title=u'android V5.7测试报告',description=u'中兴手机')
runner.run(suit)
APP UI层自动化测试--使用HTMLtestRunner生成报告
最新推荐文章于 2024-03-18 16:32:37 发布