Python junit2html:无法在结果 xml 中找到测试套件

问题描述 投票:0回答:1

我无法解析从 Robot Framework 生成的示例 xml (output.xml) 文件。 我想从上面的 xml 文件创建一个 output.html 文件。

从终端运行以下命令后出现以下错误。

junit2html output.xml output.html

这是我得到的错误片段。

Traceback (most recent call last):
  File "/usr/local/bin/junit2html", line 8, in <module>
    sys.exit(start())
  File "/Library/Python/3.9/site-packages/junit2htmlreport/runner.py", line 103, in start
    run(sys.argv[1:])
  File "/Library/Python/3.9/site-packages/junit2htmlreport/runner.py", line 90, in run
    report = parser.Junit(args[0])
  File "/Library/Python/3.9/site-packages/junit2htmlreport/parser.py", line 340, in __init__
    self.process()
  File "/Library/Python/3.9/site-packages/junit2htmlreport/parser.py", line 376, in process
    raise ParserError("could not find test suites in results xml")
junit2htmlreport.parser.ParserError: could not find test suites in results xml

我希望在将 output.xml 转换为人类可读格式的 output.html 后生成一个 HTML 文件。这样我就可以将其粘贴到电子邮件正文中

python robotframework
1个回答
0
投票

你不能为 output.xml 运行它,因为它是 Robot Framework 格式,没有 junit。您必须使用

robot --xunit junit.xml tests
参数运行测试。然后你就可以运行了
junit2html junit.xml output.html

© www.soinside.com 2019 - 2024. All rights reserved.