pit测试线路覆盖率报告中的“number”、“firstinstruction”、“lastinstruction”代表什么?

ctrmrzij  于 2021-07-06  发布在  Java
关注(0)|答案(0)|浏览(302)

我将pitest用于java项目的变异测试,但也希望使用行覆盖特性,来提取每个测试方法的单个行覆盖信息。当我运行pitest并生成linecoverge.xml报告时,报告中有三个属性我无法理解。这些属性是“number”、“firstinstruction”和“lastinstruction”。
仅供参考:我使用jacoco和eclemma提取覆盖信息。但是,这些测试作为单个进程运行,因此所有测试都同时运行。因此,不能提取每个测试方法的覆盖率信息。您必须注解掉并保持一个测试方法处于打开状态,运行测试并导出覆盖率信息。所以,如果你有100个测试,你要重做这个过程100次,这是不方便的。我相信pitest会这么做。但是,如果你知道这样的框架或工具,做到这一点,我愿意尝试!我也不明白为什么会有重复的行(见下面的报告示例)。
下面我将分享我最可怜的线路覆盖率报告的输出示例。

<block classname='org.apache.commons.csv.CSVFormat' method='format([Ljava/lang/Object;)Ljava/lang/String;' number='13' firstInstruction='64' lastInstruction='70'><tests>
<test name='org.apache.commons.csv.CSVFormatTest.testFormatThrowsNullPointerException()'/>
</tests>
</block>
<block classname='org.apache.commons.csv.CSVFormat' method='format([Ljava/lang/Object;)Ljava/lang/String;' number='13' firstInstruction='64' lastInstruction='70'><tests>
<test name='org.apache.commons.csv.CSVFormatTest.testFormatThrowsNullPointerException()'/>
</tests>
</block>
<block classname='org.apache.commons.csv.CSVFormat' method='format([Ljava/lang/Object;)Ljava/lang/String;' number='13' firstInstruction='64' lastInstruction='70'><tests>
<test name='org.apache.commons.csv.CSVFormatTest.testFormatThrowsNullPointerException()'/>
</tests>
</block>
<block classname='org.apache.commons.csv.CSVFormat' method='format([Ljava/lang/Object;)Ljava/lang/String;' number='13' firstInstruction='64' lastInstruction='70'><tests>
<test name='org.apache.commons.csv.CSVFormatTest.testFormatThrowsNullPointerException()'/>
</tests>
</block>
<block classname='org.apache.commons.csv.CSVFormat' method='format([Ljava/lang/Object;)Ljava/lang/String;' number='13' firstInstruction='64' lastInstruction='70'><tests>
<test name='org.apache.commons.csv.CSVFormatTest.testFormatThrowsNullPointerException()'/>
</tests>
</block>
<block classname='org.apache.commons.csv.CSVFormat' method='format([Ljava/lang/Object;)Ljava/lang/String;' number='13' firstInstruction='64' lastInstruction='70'><tests>
<test name='org.apache.commons.csv.CSVFormatTest.testFormatThrowsNullPointerException()'/>
</tests>
</block>
<block classname='org.apache.commons.csv.CSVFormat' method='format([Ljava/lang/Object;)Ljava/lang/String;' number='13' firstInstruction='64' lastInstruction='70'><tests>
<test name='org.apache.commons.csv.CSVFormatTest.testFormatThrowsNullPointerException()'/>
</tests>
</block>
<block classname='org.apache.commons.csv.CSVFormat' method='format([Ljava/lang/Object;)Ljava/lang/String;' number='15' firstInstruction='73' lastInstruction='76'><tests>
<test name='org.apache.commons.csv.CSVFormatTest.testFormatThrowsNullPointerException()'/>
</tests>
</block>
...

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题