首页 > 解决方案 > 使用数据提供者时压倒性的 testdox 输出(具有大量数据集)

问题描述

我们在单元测试中使用具有大量数据集的数据提供者。对于每个数据集,PHPUnit 在 testdox 输出中打印一行。在我们的例子中,这是压倒性的,使得 testdox 的输出非常难以阅读,因此毫无用处。

我找不到让 PHPUnit 在 testdox 输出中每次测试只打印一行的配置设置或注释(不管 dataprovider 返回的数据集数量)。

有没有一种方法可以让 PHPUnit 在 testdox 输出中每次测试只打印一行(无论 dataprovider 返回的数据集数量如何)?

我们使用 PHPUnit 8.4.1 和 PHP 7.2.20。

--- 编辑:添加示例 ---

这是我们当前 Testdox 输出的片段:

 ...
 ✔ Returns the cross amount to be used for the account for all appropriate accounting records with data set 805
 ✔ Returns the cross amount to be used for the account for all appropriate accounting records with data set 806
 ✔ Returns the cross amount to be used for the account for all appropriate accounting records with data set 807
 ✔ Returns the cross amount to be used for the account for all appropriate accounting records with data set 808
 ✔ Returns the cross amount to be used for the account for all appropriate accounting records with data set 809
 ✔ Returns the cross amount to be used for the account for all appropriate accounting records with data set 810
 ✔ Returns the cross amount to be used for the account for all appropriate accounting records with data set 811
 ✔ Returns the cross amount to be used for the account for all appropriate accounting records with data set 812
 ✔ Returns the cross amount to be used for the account for all appropriate accounting records with data set 813
 ✔ Returns the cross amount to be used for the account for all appropriate accounting records with data set 814
 ✔ Returns the cross amount to be used for the account for all appropriate accounting records with data set 815
 ✔ Returns the net amount to be used for the contra account for taxable aktivkonto an aufwandkonto accounting records
 ✔ Returns the net amount to be used for the contra account for taxable aktivkonto an ertragkonto accounting records
 ✔ Returns the net amount to be used for the contra account for taxable kundenkonto an aktivkonto accounting records
 ✔ Returns the net amount to be used for the contra account for taxable kundenkonto an ertragkonto accounting records
 ✔ Returns the net amount to be used for the contra account for taxable lieferantenkonto an aufwandkonto accounting records
 ✔ Returns the cross amount to be used for the contra account for all appropriate accounting records with data set 0
 ✔ Returns the cross amount to be used for the contra account for all appropriate accounting records with data set 1
 ✔ Returns the cross amount to be used for the contra account for all appropriate accounting records with data set 2
 ✔ Returns the cross amount to be used for the contra account for all appropriate accounting records with data set 3
 ✔ Returns the cross amount to be used for the contra account for all appropriate accounting records with data set 4
 ✔ Returns the cross amount to be used for the contra account for all appropriate accounting records with data set 5
 ✔ Returns the cross amount to be used for the contra account for all appropriate accounting records with data set 6
 ✔ Returns the cross amount to be used for the contra account for all appropriate accounting records with data set 7
 ✔ Returns the cross amount to be used for the contra account for all appropriate accounting records with data set 8
 ✔ Returns the cross amount to be used for the contra account for all appropriate accounting records with data set 9
 ✔ Returns the cross amount to be used for the contra account for all appropriate accounting records with data set 10
 ✔ Returns the cross amount to be used for the contra account for all appropriate accounting records with data set 11
 ...

这可能是一个更精简的输出,例如,如果没有数据集会让测试失败:

 ...
 ✔ Returns the cross amount to be used for the account for all appropriate accounting records
 ✔ Returns the net amount to be used for the contra account for taxable aktivkonto an aufwandkonto accounting records
 ✔ Returns the net amount to be used for the contra account for taxable aktivkonto an ertragkonto accounting records
 ✔ Returns the net amount to be used for the contra account for taxable kundenkonto an aktivkonto accounting records
 ✔ Returns the net amount to be used for the contra account for taxable kundenkonto an ertragkonto accounting records
 ✔ Returns the net amount to be used for the contra account for taxable lieferantenkonto an aufwandkonto accounting records
 ✔ Returns the cross amount to be used for the contra account for all appropriate accounting records
 ...

标签: phpphpunit

解决方案


不,没有这样的设置。而且我认为添加它不会有用。您可能想要查看@testdox注释以及在此处使用变量(来自数据提供者参数)以产生更有用的输出的可能性。


推荐阅读