【问题标题】:Is it possible to extract mutation testing results for every test method with Pit Mutation Test是否可以使用 Pit Mutation Test 提取每种测试方法的突变测试结果
【发布时间】:2020-04-21 20:44:35
【问题描述】:

我知道PIT Mutation Test framework可以根据测试套件或者测试类导出变异覆盖信息。但是,我想知道是否有一个选项可以根据测试用例方法(@Test 注释下的测试用例)提取或导出突变覆盖率信息,以便我可以看到哪些测试用例写得好,哪些写得不好。如果不可能,我想到的最简单的解决方案是注释所有测试方法并仅取消注释其中一种测试方法,运行它并导出信息。我想知道是否有一个优雅的解决方案。

注意:我知道MuJava 提供了此类信息。

【问题讨论】:

    标签: unit-testing mutation-testing pitest


    【解决方案1】:

    这可以通过(严重/未)记录的矩阵功能来完成。

    假设您使用的是 maven,您需要添加

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

    到你的 pom。

    然后,XML 输出将在终止测试节点中包含管道分隔的测试名称。

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

    【讨论】:

    • 我还有一个很小的问题。 “killingTests”和“succeedingTests”有什么区别?
    猜你喜欢
    • 1970-01-01
    • 2013-12-13
    • 2013-09-03
    • 2022-01-02
    • 2014-12-24
    • 2019-04-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多