是否可以提取Pit Mutation Test的每个测试方法的变异测试结果?

huangapple go评论64阅读模式
英文:

Is it possible to extract mutation testing results for every test method with Pit Mutation Test

问题

我知道PIT Mutation Test framework可以基于测试套件或测试类导出变异覆盖信息。但是,我想知道是否有选项可以基于测试用例方法(在@Test注释下的测试用例)提取或导出变异覆盖信息,以便我可以看到哪些测试用例编写得很好,哪些不好。如果不可能,我脑海中最简单的解决方案是注释掉所有测试方法,然后只取消注释一个测试方法,运行它并导出信息。我想知道是否有更优雅的解决方案。

注意:我知道MuJava提供这样的信息。

英文:

I know that PIT Mutation Test framework can export mutation coverage information based on the test suite or the test class. However, I was wondering if there is an option to extract or export mutation coverage information based on the test case methods (test cases under the @Test annotation), so that I can see which test cases are written well and which are not. If it is not possible, the simplest solution that comes to my mind is commenting all the test methods and uncommenting only one of the test methods, run it and export the information. I wanted to know if there is an elegant solution.

Note: I know that MuJava provides such information.

答案1

得分: 3

以下是翻译好的内容:

这可以通过(糟糕/未经记录的)矩阵功能完成。

假设您正在使用Maven,您需要添加:

<fullMutationMatrix>true</fullMutationMatrix>
<outputFormats>
<param>XML</param>
</outputFormats>

到您的pom文件中。

然后XML输出将包含在killing测试节点中以竖线分隔的测试名称。

<killingTests>foo|foo2</killingTests>
<succeedingTests>bar</succeedingTests>

英文:

This can be done with the (badly/un)documented matrix feature.

Assuming you're using maven you'll need to add

&lt;fullMutationMatrix&gt;true&lt;/fullMutationMatrix&gt;
&lt;outputFormats&gt;
 &lt;param&gt;XML&lt;/param&gt;
&lt;/outputFormats&gt;

To your pom.

The XML output will then contain pipe separated test names in the killing test nodes.

&lt;killingTests&gt;foo|foo2&lt;/killingTests&gt;
&lt;succeedingTests&gt;bar&lt;/succeedingTests&gt;

huangapple
  • 本文由 发表于 2020年1月3日 17:26:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/59575974.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定