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

Allowed more tests to be considered killing a mutant when using historic data (fixes #763) #765

Merged
merged 2 commits into from
May 10, 2020

Conversation

StefanPenndorf
Copy link
Contributor

fixes #763

Incremental analysis honors all killing tests now instead of limiting the scope of analysis to the first killing test.
This is often identical if there is no matrix mutation in place but TestNG plugin calculates test units in terms of test classes thus executes all test methods of a test class and records historic data
with method level granularity and class level granularity. We need to take all killing tests into account to match history data and executable test units in the analyzer. This will also help if different test classes cover a certain production class and one of those test classes is deleted or renamed.

Improved logging to help spotting analyzer misbehaviour. Although pitest is already verbose I added another info-level statement.

I've also refactored the test and added more test cases to prove the correctness of my changes.

fixes hcoles#763

Incremental analysis honors all killing tests now instead of limiting
the scope of analysis to the first killing test.
This is often identical if there is no matrix mutation in place but
TestNG plugin calculates test units in terms of test classes thus
executes all test methods of a test class and records historic data
with method level granularity and class level granularity. We need
to take all killing tests into account to match history data and
executable test units in the analyzer. This will also help if
different test classes cover a certain production class and one of
those test classes is deleted or renamed.

Improved logging to help spotting analyzer misbehaviour.
Changing the configuration of the Logger is a global setting per JVM.
When running tests with surefire the JVM will be reused among tests.
Permanently changing the logging configuration might interfere with
other tests.
for (Handler handler : logger.getHandlers()) {
logger.removeHandler(handler);
}
logger.addHandler(logCatcher);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@StefanPenndorf Are we introducing a memory leak into the test suite here? If nothing removes the LogCatcher when the last runs then presumably it continues to accumulate log entries until the JVM exits?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, my first commit had this issue: It introduced a memory leak as well as changing the behaviour for subsequent tests. Thus I decided not to disable default handlers by removing them and to remove the log catcher in a tear down method (annotated with @After)

I guess you found the fix because you merged my change in anyway.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Saw your change come in so merged it - hopefully not prematurely?

Tracked down a leak exactly like this one in a commercial test suite years ago, so knew to look for it when testing logging.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything well, pull request was complete with two commits. Would have left a note if I knew there was something wrong/missing.

@hcoles hcoles merged commit 503e939 into hcoles:master May 10, 2020
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

Successfully merging this pull request may close these issues.

Increment Analysis Issue
2 participants