我正在使用魅力2.8.1。我已使用 NPM 将其安装到我的 docker 容器中。之后,我运行allure generate test-results
命令从 junit xml 生成魅力报告,该报告是使用 newman 工具生成的。
在报告目录中,会出现一个空目录data/attachments
和一个data/test-cases
包含 junit xml 中所有测试用例的目录。
测试用例 xml 示例:
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="test-collection-2" tests="1" time="0.463">
<testsuite name="Test succeed request" id="b3ce6542-d493-4206-b67b-e74e4ca58fde" tests="2" failures="0" errors="0" time="0.463">
<testcase name="Status code is 200" time="0.463"/>
<testcase name="Content-Type is present" time="0.463"/>
</testsuite>
</testsuites>
Run Code Online (Sandbox Code Playgroud)
你能帮我解决这个问题吗?
Allure 需要 Web 服务器来打开报告。生成后我们不能简单地打开index.html
文件。要在本地计算机中打开生成的报告,有两种方法
open
命令。allure open path/to/report
Run Code Online (Sandbox Code Playgroud)
这将在您的默认网络浏览器中打开报告。
python -m SimpleHTTPServer 8626
Run Code Online (Sandbox Code Playgroud)
0.0.0.0:8626
现在在浏览器中打开。
如果您上传生成的网络服务器目录,这将没有任何问题。