这将在 junit 中捕获标准输出但不会打印它
py.test --verbose simpletest.py --junit-xml=test.xml
Run Code Online (Sandbox Code Playgroud)
这不会在 junit 中捕获 stdout 并将打印它
py.test --verbose --capture=no simpletest.py --junit-xml=test.xml
Run Code Online (Sandbox Code Playgroud)
如何允许 pytest 打印到标准输出并将标准输出打印到 junit xml?
小智 2
对于 pytest-2.3.5,我们可以生成类似的 junit-xml 输出
pytest --verbose --junitxml=filepath\\file.xml file.py
Run Code Online (Sandbox Code Playgroud)
我用 file.py 进行了 pytest 测试对此进行了测试。--verbose命令行参数只是为了在控制台上输出详细的测试结果。
我还尝试通过从另一个 python 脚本调用我的测试脚本来生成类似的 xml 文件
pytest.main(["--verbose","--junitxml=filepath\\file.xml","filepath\\file.py"])
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3231 次 |
| 最近记录: |