如果某个特定的测试失败了,那么跳过每个剩余测试的最佳方法是什么_在线.py失败,则无需继续运行:
tests/test_001_springboot_monitor.py::TestClass::test_service_monitor[TEST12] PASSED [ 2%]
tests/test_002_wips_online.py::TestClass::test01_online[TEST12] FAILED [ 4%]
tests/test_003_idpro_test_api.py::TestClass::test01_testapi_present[TEST12] PASSED [ 6%]
我喜欢跳过所有剩下的测试,写测试报告。 我应该写入一个状态文件并编写一个检查它的函数吗?你知道吗
@pytest.mark.skipif(setup_failed(), reason="requirements failed")
从文档:http://pytest.org/en/latest/usage.html#stopping-after-the-first-or-n-failures
你应该看看pytest依赖插件:https://pytest-dependency.readthedocs.io/en/latest/usage.html
在本例中,如果测试\u b失败,则不会执行测试\u d
我发现,如果我的任何关键预定义测试失败,调用
pytest.exit("error message")
是最方便的。pytest将完成所有的post作业,如html报告、屏幕截图,并且您的错误消息将打印在末尾:相关问题 更多 >
编程相关推荐