这两个标签在 Pitest XML 报告中代表什么?
What these two tags represent in a Pitest XML report?
我目前正在尝试提取从工具报告中生成的突变,并且我目前正在努力使用 Pitest。
给定一个XML Pitest报告,它有一个突变列表;每个突变元素都有 n 个属性,包括 index
和 block
,我无法理解它们代表什么。
排除它们,我有一个突变重叠的问题,即两个不同的突变具有相同的参数;包括他们在内,我都没有这个问题。
它们代表什么?
这是包含两个冲突突变的报告示例:
<?xml version="1.0" encoding="UTF-8"?>
<mutations>
<mutation detected='false' status='SURVIVED' numberOfTestsRun='2'><sourceFile>HelpFormatter.java</sourceFile><mutatedClass>org.apache.commons.cli.HelpFormatter</mutatedClass><mutatedMethod>renderOptions</mutatedMethod><methodDescription>(Ljava/lang/StringBuffer;ILorg/apache/commons/cli/Options;II)Ljava/lang/StringBuffer;</methodDescription><lineNumber>786</lineNumber><mutator>org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_ELSE</mutator><index>122</index><block>37</block><killingTest/><description>removed conditional - replaced equality check with false</description></mutation>
<mutation detected='false' status='SURVIVED' numberOfTestsRun='1'><sourceFile>HelpFormatter.java</sourceFile><mutatedClass>org.apache.commons.cli.HelpFormatter</mutatedClass><mutatedMethod>renderOptions</mutatedMethod><methodDescription>(Ljava/lang/StringBuffer;ILorg/apache/commons/cli/Options;II)Ljava/lang/StringBuffer;</methodDescription><lineNumber>786</lineNumber><mutator>org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_ELSE</mutator><index>125</index><block>39</block><killingTest/><description>removed conditional - replaced equality check with false</description></mutation>
</mutations>
这是导致这两个突变的 Java 行:
if (argName != null && argName.length() == 0)
根据 pitest 上的 javadoc,
https://github.com/hcoles/pitest/blob/90d5df53a32c62f78695232410ab2e2009cd82b9/pitest/src/main/java/org/pitest/mutationtest/engine/MutationDetails.java#L202-L208
索引是 the index to the ... instruction on which this mutation occurs. This index is specific to how ASM represents the bytecode
.
https://github.com/hcoles/pitest/blob/90d5df53a32c62f78695232410ab2e2009cd82b9/pitest/src/main/java/org/pitest/mutationtest/engine/MutationDetails.java#L171-L177
区块是 basic block in which this mutation occurs
.
https://github.com/hcoles/pitest/issues/131#issuecomment-47398717
block based means coverage is tracked per non-branching code block. Oversimplified this can be seen as coverage is recorder per pair of curly braces. If you don't have any control flow statement inside a method there is just one block. If you have an if statement (without else) there will be up to 3 blocks (one before the if statement, the "then" part of the if statement and one block after the if statement and so on).
我目前正在尝试提取从工具报告中生成的突变,并且我目前正在努力使用 Pitest。
给定一个XML Pitest报告,它有一个突变列表;每个突变元素都有 n 个属性,包括 index
和 block
,我无法理解它们代表什么。
排除它们,我有一个突变重叠的问题,即两个不同的突变具有相同的参数;包括他们在内,我都没有这个问题。
它们代表什么?
这是包含两个冲突突变的报告示例:
<?xml version="1.0" encoding="UTF-8"?>
<mutations>
<mutation detected='false' status='SURVIVED' numberOfTestsRun='2'><sourceFile>HelpFormatter.java</sourceFile><mutatedClass>org.apache.commons.cli.HelpFormatter</mutatedClass><mutatedMethod>renderOptions</mutatedMethod><methodDescription>(Ljava/lang/StringBuffer;ILorg/apache/commons/cli/Options;II)Ljava/lang/StringBuffer;</methodDescription><lineNumber>786</lineNumber><mutator>org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_ELSE</mutator><index>122</index><block>37</block><killingTest/><description>removed conditional - replaced equality check with false</description></mutation>
<mutation detected='false' status='SURVIVED' numberOfTestsRun='1'><sourceFile>HelpFormatter.java</sourceFile><mutatedClass>org.apache.commons.cli.HelpFormatter</mutatedClass><mutatedMethod>renderOptions</mutatedMethod><methodDescription>(Ljava/lang/StringBuffer;ILorg/apache/commons/cli/Options;II)Ljava/lang/StringBuffer;</methodDescription><lineNumber>786</lineNumber><mutator>org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_ELSE</mutator><index>125</index><block>39</block><killingTest/><description>removed conditional - replaced equality check with false</description></mutation>
</mutations>
这是导致这两个突变的 Java 行:
if (argName != null && argName.length() == 0)
根据 pitest 上的 javadoc,
https://github.com/hcoles/pitest/blob/90d5df53a32c62f78695232410ab2e2009cd82b9/pitest/src/main/java/org/pitest/mutationtest/engine/MutationDetails.java#L202-L208
索引是 the index to the ... instruction on which this mutation occurs. This index is specific to how ASM represents the bytecode
.
https://github.com/hcoles/pitest/blob/90d5df53a32c62f78695232410ab2e2009cd82b9/pitest/src/main/java/org/pitest/mutationtest/engine/MutationDetails.java#L171-L177
区块是 basic block in which this mutation occurs
.
https://github.com/hcoles/pitest/issues/131#issuecomment-47398717
block based means coverage is tracked per non-branching code block. Oversimplified this can be seen as coverage is recorder per pair of curly braces. If you don't have any control flow statement inside a method there is just one block. If you have an if statement (without else) there will be up to 3 blocks (one before the if statement, the "then" part of the if statement and one block after the if statement and so on).