2019年9月21日

pytest-参数化2

摘要: Process finished with exit code 0打开首页登陆lindaPASSED [ 33%]不同用户添加购物车linda打开首页登陆saiPASSED [ 66%]不同用户添加购物车sai打开首页登陆tomPASSED [100%]不同用户添加购物车tom 阅读全文

posted @ 2019-09-21 23:43 barton123 阅读(179) 评论(0) 推荐(0)

pytest---参数化

摘要: est_param.py::test_eval[2-1-1] test_param.py::test_eval[7*5-30] PASSED [ 33%]PASSED [ 66%]FAILED [100%]test_param.py:3 (test_eval[7*5-30])35 != 30 Exp 阅读全文

posted @ 2019-09-21 23:31 barton123 阅读(160) 评论(0) 推荐(0)

pytest--fixure前置执行一个函数

摘要: pytest_twofixture.py::test_soso PASSED [ 50%]case3 pytest_twofixture.py::test_cart 登陆PASSED [100%]case4 案例2 pytest_twofixture.py::test_soso PASSED [ 5 阅读全文

posted @ 2019-09-21 23:06 barton123 阅读(413) 评论(0) 推荐(0)

pytest--fixture---自动应用

摘要: 打开浏览器登陆PASSED [ 50%]case3 pytest_twofixture.py::test_cart 打开浏览器登陆PASSED [100%]case4 阅读全文

posted @ 2019-09-21 23:00 barton123 阅读(231) 评论(0) 推荐(0)

pytest--两个fixture时,灵活运用

摘要: pytest_twofixture.py::test_soso 打开浏览器PASSED [ 50%]case3 pytest_twofixture.py::test_cart 打开浏览器登陆PASSED [100%]case4 阅读全文

posted @ 2019-09-21 22:58 barton123 阅读(184) 评论(0) 推荐(0)

pytest--fixture之参数化

摘要: 场景:测试用例执行时,有的用例需要登陆才能执行,有些用例 不需要登陆。setup和teardown无法满足。fixture可以。默认 scope(范围)function • 步骤: 1. 导入pytest 2. 在登陆的函数上面加@pytest.fixture() 3. 在要使用的测试方法中传入(登 阅读全文

posted @ 2019-09-21 22:45 barton123 阅读(432) 评论(0) 推荐(0)

pytest_fixture--scope="session"

摘要: pytest_fixture.py::test_cart 输入用户名密码登陆! configtestPASSED [ 33%]用例1,登陆后执行添加购物车功能操作 pytest_fixture.py::test_search PASSED [ 66%]用例2,不登陆查询功能操作 pytest_fix 阅读全文

posted @ 2019-09-21 22:37 barton123 阅读(1337) 评论(0) 推荐(0)

pytest_fixture-----conftest共享数据及不同层次共享

摘要: 场景:你与其他测试工程师合作一起开发时,公共的模块要在不同文件中,要 在大家都访问到的地方。 解决:使用conftest.py 这个文件进行数据共享,并且他可以放在不同位置起 着不同的范围共享作用。 前提:conftest文件名是不能换的,放在项目下是全局的数据共享的地方,全 局的配置和前期工作都可 阅读全文

posted @ 2019-09-21 22:31 barton123 阅读(548) 评论(0) 推荐(0)

pytest----fixture(1)--使用fixture执行配置及销毁逻辑

摘要: 1使用fixture执行配 置及销毁;非常灵活 使用。 2数据共享:在 conftest.py配置里写方 法可以实现数据共享, 不需要import导入。可 以跨文件共享 3scope的层次及神 奇的yield组合相当 于各种setup 和teardown 使用fixture执行配置及销毁逻辑 场景: 阅读全文

posted @ 2019-09-21 22:22 barton123 阅读(470) 评论(0) 推荐(0)

pytest-文件名类名方法名执行部分用例

摘要: pytest test_class_01.py 执行文件名 pytest -v -s test_class_01.py 执行文件名 pytest -v test_class_01.py::TestClass 执行类名 pytest -v test_class_01.py::TestClass::te 阅读全文

posted @ 2019-09-21 17:51 barton123 阅读(631) 评论(0) 推荐(0)

pytest_按标记执行

摘要: pytest -s test_mark.py -m 'not ios' 执行标记不等于ios的 pytest -s test_mark.py -m ios 只执行标记==ios的 pytest -s test_mark.py -m=ios 只执行标记==ios的 阅读全文

posted @ 2019-09-21 17:46 barton123 阅读(286) 评论(0) 推荐(0)

统计列表中出现的个数,统计列表中元素出现的个数

摘要: 今天竟然犯傻了,竟然理解错了 {'a': 3, 1: 5, 2: 2, 3: 2, 'c': 1, 4: 1, 6: 1} 阅读全文

posted @ 2019-09-21 16:38 barton123 阅读(3600) 评论(0) 推荐(0)

pytest-mark跳过

摘要: import pytestimport sysenvironment='android'@pytest.mark.skipif(environment=="android",reason='android平台没有这个功能,只有ios下有')def test_add(): print("apple")def test_add2(): print("android")@pytest.mark.skip 阅读全文

posted @ 2019-09-21 15:48 barton123 阅读(255) 评论(0) 推荐(0)

pytest的断言、跳过、运行的按需要处理

摘要: def test_one(): assert 1==1 assert 1!=2 assert {'name':'linda','age':19}=={'name':'linda','age':190} assert 'hello' in 'helloworld' age=35 assert 20<age<80 assert (1<2) ==Truedef f(): return 3def test 阅读全文

posted @ 2019-09-21 14:53 barton123 阅读(378) 评论(0) 推荐(0)

Pytest初体验

摘要: Pytest安装,导入相关依赖哭 Pip3 install –U pytest U表示升级 Pip3 install pytestsugar pip3 install pytest-rerunfailures Pip3 install pytest-xdist Pip3 install pytest 阅读全文

posted @ 2019-09-21 14:15 barton123 阅读(196) 评论(0) 推荐(0)

导航