如何配置PHPunit测试结果输出到HTML文件?

时间:2022-05-14 03:14:22

I'm using phpunit for testing and I really need html reports in HTML format. Please show me the simplest way or code example.

我正在使用phpunit进行测试,我真的需要HTML格式的HTML报告。请告诉我最简单的方法或代码示例。

1 个解决方案

#1


4  

Build in phpunit you can generate a report in HTML using the --testdox-html <output file> option. The output is very rudimentary.

在phpunit中构建,您可以使用--testdox-html <输出文件> 选项以HTML格式生成报告。输出非常简陋。

Alternatively you can generate the junit xml output using the --log-junit <output file> option and transform the xml output to html with an xsl-script, e.g. the one from phing (you will need phpunit-noframes.xsl and str.replace.function.xsl) using an xsltprocessor like xsltproc. This will give a little bit more information.

或者,您可以使用--log-junit 选项生成junit xml输出,并使用xsl脚本将xml输出转换为html,例如:来自phing的那个(你需要phpunit-noframes.xsl和str.replace.function.xsl)使用像xsltproc这样的xsltprocessor。这将提供更多信息。

For the ultimate power there are frontends for phpunit which displays the test results in the browser as HTML, this could be worth a look as well:

为了最终的力量,有phpunit的前端,它在浏览器中以HTML显示测试结果,这也值得一看:

#1


4  

Build in phpunit you can generate a report in HTML using the --testdox-html <output file> option. The output is very rudimentary.

在phpunit中构建,您可以使用--testdox-html <输出文件> 选项以HTML格式生成报告。输出非常简陋。

Alternatively you can generate the junit xml output using the --log-junit <output file> option and transform the xml output to html with an xsl-script, e.g. the one from phing (you will need phpunit-noframes.xsl and str.replace.function.xsl) using an xsltprocessor like xsltproc. This will give a little bit more information.

或者,您可以使用--log-junit 选项生成junit xml输出,并使用xsl脚本将xml输出转换为html,例如:来自phing的那个(你需要phpunit-noframes.xsl和str.replace.function.xsl)使用像xsltproc这样的xsltprocessor。这将提供更多信息。

For the ultimate power there are frontends for phpunit which displays the test results in the browser as HTML, this could be worth a look as well:

为了最终的力量,有phpunit的前端,它在浏览器中以HTML显示测试结果,这也值得一看: