Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extracting mutation information from verbose log #76

Open
mohimoradi opened this issue Jan 5, 2023 · 6 comments
Open

Extracting mutation information from verbose log #76

mohimoradi opened this issue Jan 5, 2023 · 6 comments

Comments

@mohimoradi
Copy link

I'm attempting to extract mutation information from the verbose log. I ran the pit on the Saga Actuator project and saved the log file using the command below.

mvn clean test-compile org.pitest:pitest-maven:mutationCoverage -Dverbose=true -DtimeoutConstant=3000 -fn --log-file Pitlog.txt

By exploring the mutation coverage in the pit report for each sub-module and adding it all up. There were 468 mutations covered in total. However, when I searched the log file, I only found 354 mutations. I check by matching each line that contains "detected = SURVIVED by" or "detected = KILLED by," resulting in 291 killed and 63 survivors. So around 114 mutations are missing in the log file.
If I'm wrong in that assumption, what are the criteria for finding all of the covered mutations?

Thanks

@mohimoradi mohimoradi changed the title Extract mutation information from verbose log Extracting mutation information from verbose log Jan 5, 2023
@hcoles
Copy link
Contributor

hcoles commented Jan 5, 2023

Pitest provides structured output (XML and CSV) which would be easier to work with than log files and might be worth considering instead.

There are more dection statuses than SURVIVED and KILLED, which probably explains your missing mutants. See

https://pitest.org/quickstart/basic_concepts/

@mohimoradi
Copy link
Author

Thanks!

	<plugin>
	    <groupId>org.pitest</groupId>
	    <artifactId>pitest-maven</artifactId>
	    <version>LATEST</version>
		<configuration>
			<fullMutationMatrix>true</fullMutationMatrix>
			<outputFormats>
			 <param>XML</param>
			</outputFormats>
		</configuration>
	</plugin>

@mohimoradi mohimoradi reopened this Jan 7, 2023
@mohimoradi
Copy link
Author

If the status is TIMED OUT, pit will not report the failing tests, but those will be counted as killed mutations in the HTML report. How can I collect the tests that result in the TIMED OUT status?

<mutation detected='true' status='TIMED_OUT' numberOfTestsRun='0'><sourceFile>SagaExecutionQueryService.java</sourceFile><mutatedClass>org.apache.servicecomb.saga.spring.SagaExecutionQueryService</mutatedClass><mutatedMethod>lambda$querySagaExecutionDetail$2</mutatedMethod><methodDescription>(Lorg/apache/servicecomb/saga/spring/SagaEventEntity;)Z</methodDescription><lineNumber>133</lineNumber><mutator>org.pitest.mutationtest.engine.gregor.mutators.returns.BooleanFalseReturnValsMutator</mutator><indexes><index>8</index></indexes><blocks><block>3</block></blocks><killingTests></killingTests><succeedingTests></succeedingTests><description>replaced boolean return with false for org/apache/servicecomb/saga/spring/SagaExecutionQueryService::lambda$querySagaExecutionDetail$2</description></mutation>

@hcoles
Copy link
Contributor

hcoles commented Jan 7, 2023

You would need to modify pitest so that the test that times out was captured. I believe this is less straightforward than it appears, but haven't looked at this area of the code for some years.

@mohimoradi
Copy link
Author

Would you kindly provide me with some hints as to what part of the code could require editing? I'll try to change that.

@hcoles
Copy link
Contributor

hcoles commented Jan 8, 2023

You would need to alter the Repoter interface and its default implementation so that test names were sent to the parent process before each test was run. Then, if the child process were to hang, the parent process would be able to infer which test caused that infinite loop.

https://github.com/hcoles/pitest/blob/master/pitest/src/main/java/org/pitest/mutationtest/execute/DefaultReporter.java

This would be a non trivial change to the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants