GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — auto_testing/test_auto_app.py at master · davidway/auto_testing Expand file tree/ Copy pathtest_auto_app.pyMore file actions 101 lines (76 loc) · 2.72 KB / Copy pathtest_auto_app.pyFile metadata and controls101 lines (76 loc) · 2.72 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 # -*- coding:utf-8 -*- import unittest import HTMLTestReportCN from appium import webdriver import time import ddt #测试用例 class YunzaiTest(unittest.TestCase): def setUp(self): desired_caps = { "platformName": "Android", "deviceName": "Honor 9", "appPackage": "com.dgwsy.blockchain.yunzai", "appActivity": "com.dgwsy.restaurantassistant.activity.LunchActivity", "platformVersion": "8.0.0", } self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) time.sleep(5) contexts = self.driver.contexts self.driver.switch_to.context(contexts[1]) def tearDown(self): pass def testCase1(self): self.assertEqual(2,2,"testError") def testDig(self,username,password): usernameElement = self.driver.find_element_by_css_selector( '#Loginput >div.inputbox >div.ipt >input[type="text"]') usernameElement.send_keys(username) passwordElement = self.driver.find_element_by_css_selector( '#Loginput>div.inputbox>div.ipt>input[type="password"]') passwordElement.send_keys(password) buttonElement = self.driver.find_element_by_css_selector("#Logphone>button") buttonElement.click() time.sleep(3) for loopTimes in range(0, 5): for num in range(0, 10): try: pathText = "#top > div.mining-main > div > div.float-box.animated.position_" + str( num) + " > button" print(pathText) kuangElement = self.driver.find_element_by_css_selector(pathText) kuangElement.click() except Exception as err: print(err) continue self.driver.implicitly_wait(30) class APITestCase(unittest.TestCase): def setUp(self): pass def tearDown(self): pass def testCase1(self): self.assertEqual(2, 2, "testError") #添加Suite def Suite(): #定义一个单元测试容器 suiteTest = unittest.TestSuite() #将测试用例加入到容器 suiteTest.addTest(YunzaiTest("testDig")) suiteTest.addTest(APITestCase("testCase1")) return suiteTest if __name__ == '__main__': #确定生成报告的路径 filePath ='F:/HTMLTestReportCN.html' fp = open(filePath,'wb') #生成报告的Title,描述 runner = HTMLTestReportCN.HTMLTestRunner( stream=fp, title='自动化测试报告', #description='详细测试用例结果', tester='weekendzhu' ) #运行测试用例 runner.run(Suite()) # 关闭文件,否则会无法生成文件 fp.close() |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |