如何将PHPUnit测试保存为单独的TAP结果

时间:2022-10-15 22:28:38

I have a jenkins setup that runs some unit tests with PHPUnit.

我有一个jenkins设置,它使用PHPUnit运行一些单元测试。

I would like each unit testcase to be saved as a separate tap result file.

我希望将每个单元testcase保存为一个单独的tap结果文件。

E.g. the results of testOneTest.php and testTwoTest.php will be saved as testOneTest.tap and testTwoTest.tap respectively. This presents build results much better in the Jenkins UI.

考试的结果。php和testTwoTest。php将被保存为testOneTest。自来水和testTwoTest。分别利用。这在Jenkins UI中提供了更好的构建结果。

I have defined an XML configuration file for PHPUnit, but from the documentation, I can only see the option to save as a single tap result file:

我已经为PHPUnit定义了一个XML配置文件,但是从文档中,我只能看到作为单个tap结果文件保存的选项:

<log type="tap" target="/tmp/logfile.tap"/>

<日志类型=“龙头”目标= " tmp logfile.tap>

Is it possible to save multiple TAP results? Cheers.

是否可以保存多个TAP结果?欢呼。

1 个解决方案

#1


0  

If you're using XML configuration files, just create two different configuration files with different output names. Depending on how you invoke phpunit, then it could look like this:

如果您正在使用XML配置文件,只需创建两个具有不同输出名称的不同配置文件。根据调用phpunit的方式,它可以是这样的:

1> phpunit -c /your/xml/configfile1.xml testOneTest.php
2> phpunit -c /your/xml/configfile2.xml testTwoTest.php

You also could just give the output parameter to phpunit:

你也可以给phpunit输出参数:

1> phpunit --log-tap /tmp/logfile1.tap testOneTest.php
2> phpunit --log-tap /tmp/logfile2.tap testTwoTest.php 

#1


0  

If you're using XML configuration files, just create two different configuration files with different output names. Depending on how you invoke phpunit, then it could look like this:

如果您正在使用XML配置文件,只需创建两个具有不同输出名称的不同配置文件。根据调用phpunit的方式,它可以是这样的:

1> phpunit -c /your/xml/configfile1.xml testOneTest.php
2> phpunit -c /your/xml/configfile2.xml testTwoTest.php

You also could just give the output parameter to phpunit:

你也可以给phpunit输出参数:

1> phpunit --log-tap /tmp/logfile1.tap testOneTest.php
2> phpunit --log-tap /tmp/logfile2.tap testTwoTest.php