摘要: 在代码中执行pytest可以通过main函数 加参数来指定运行规则时,参数需要放在列表或者元祖中 # pytest.main(["--html=report.html"]) # pytest.main(["--collect-only"])#展示所有测试用例 # pytest.main(["-k", 阅读全文
posted @ 2019-11-20 17:51 阿宅gogo 阅读(2856) 评论(0) 推荐(0)
摘要: 对一个参数进行参数化 @pytest.mark.parametrize('password',["112312","123456","aqww12"]) def test_1(password): a = lo.login_post("username",password) assert a== " 阅读全文
posted @ 2019-11-20 17:44 阿宅gogo 阅读(288) 评论(0) 推荐(0)
摘要: 标记函数 为了确定执行的测试函数,可以对函数进行标记 1、执行时使用 :: 指定函数名称 2、执行时使用 -k 对函数进行模糊匹配 3、使用pytest.mark在函数上进行标记,在测试时使用 -m选择标记的测试函数 一个函数可以打上多个标记;多个函数也可以打上相同的标记 在运行时使用-m 可以家伙 阅读全文
posted @ 2019-11-20 16:45 阿宅gogo 阅读(665) 评论(0) 推荐(0)