英文:
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
<fullMutationMatrix>true</fullMutationMatrix>
<outputFormats>
<param>XML</param>
</outputFormats>
To your pom.
The XML output will then contain pipe separated test names in the killing test nodes.
<killingTests>foo|foo2</killingTests>
<succeedingTests>bar</succeedingTests>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论