- 博客(7)
- 收藏
- 关注
原创 Pytest 初始
>安装Pip install pytest>用例设计原则文件名以 test_.py 文件和_test.py以 test_ 开头的函数以 Test 开头的类,不能包含 init 方法以 test_ 开头的类里面的方法所有的包 pakage 必项要有__init__.py 文件不符合规则的测试用例不会执行.class Test_Demo(): def test_demo(self): assert 1 print('pass')
2020-08-20 21:01:28
623
原创 Appium 功能测试-常用方法封装
1.1 查找单个元素def find_element(self, by, locator): try: element = WebDriverWait(self.driver, self.outTime).until(lambda x: x.find_element(by, locator)) except TimeoutException as t: print('timeout!') else:
2020-07-20 22:07:30
322
原创 python -异常处理
1try: if ':' in date: time.strptime(date, "%Y-%m-%d %H:%M:%S") else: time.strptime(date, "%Y-%m-%d") return Trueexcept: print('date value is wrong!') return False
2020-05-21 15:22:41
212
原创 Python - 返回格式判断
# 返回为手机号def verify_phone(phone): phone_pattern = r'1\d{10}' result = re.match(phone_pattern, phone) if result != None and len(phone) == 11: return True else: return False#返回为日期格式:def verify_date(date): try:
2020-05-21 15:21:40
402
原创 自动化--接口测试
自动化–接口测试def api_test():# request-getparams = {‘key1’: ‘value1’, ‘key2’: ‘value2’} # 参与以字典形式传递r = requests.get(“http://www.baidu.com”, params=params)# request-post,编码方式由content-type 判断data = {'key1': 'value1', 'key2': 'value2'} # 字典 # 1.form格式(appli
2020-05-11 22:03:26
205
原创 自动化测试--浏览器
自动化测试–浏览器def control_chrome():#启动浏览器chromeOptions = webdriver.ChromeOptions()chromeOptions.add_experimental_option(“useAutomationExtension”, False) #处理权限弹窗driver_path = os.getcwd() + r’/driver/chromedriver.exe’driver = webdriver.Chrome(executable_pa
2020-05-11 22:01:42
190
原创 功能测试--自动化
功能测试–自动化###App###def control_app():# 启动desired_caps = {‘platformName’: ‘Android’,‘platformVersion’: ‘7.0’,‘deviceName’: ‘Android Emulator’,‘appPackage’: ‘com.cn.test’,‘appActivity’: ‘activity’}driver = webdriver.Remote(‘http://127.0.0.1:4723/wd/
2020-05-11 22:00:21
171
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人