0
0
JUnittesting~20 mins

Mutation testing concept (PIT) in JUnit - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Mutation Testing Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
What is the main goal of mutation testing?
Mutation testing is a technique used in software testing. What is its primary purpose?
ATo check if the test suite can detect small changes (mutations) in the code
BTo find syntax errors in the source code before compilation
CTo automatically generate user interface tests
DTo measure the performance of the application under load
Attempts:
2 left
💡 Hint
Think about how mutation testing challenges your tests.
Predict Output
intermediate
1:00remaining
What is the mutation score for this test result?
Given a mutation testing run with 100 mutants generated, 80 mutants killed by tests, and 20 mutants survived, what is the mutation score percentage?
A80%
B20%
C100%
D0%
Attempts:
2 left
💡 Hint
Mutation score = (killed mutants / total mutants) * 100
assertion
advanced
1:30remaining
Which assertion correctly verifies a mutation testing report's killed mutants count?
You have a variable killedMutants = 45 from a mutation testing report. Which JUnit assertion correctly checks that killedMutants equals 45?
AassertNull(killedMutants);
BassertEquals(45, killedMutants);
CassertFalse(killedMutants != 45);
DassertTrue(killedMutants == 45);
Attempts:
2 left
💡 Hint
Use the assertion that compares expected and actual values directly.
🔧 Debug
advanced
2:00remaining
Why does PIT report 0% mutation coverage despite tests passing?
You run PIT mutation testing on your Java project. All unit tests pass, but PIT reports 0% mutation coverage. What is the most likely cause?
AThe tests have syntax errors and do not run
BThe code has no mutations generated by PIT
CThe tests do not execute the mutated code paths at all
DPIT only works with integration tests, not unit tests
Attempts:
2 left
💡 Hint
Think about what it means if mutants survive despite tests passing.
framework
expert
2:30remaining
Which PIT configuration option excludes test classes from mutation analysis?
In PIT configuration for a Maven project, which option correctly excludes test classes from mutation testing?
A<targetTests>**/*Test*</targetTests>
B<targetClasses>**/*Test*</targetClasses>
C<excludedMethods>test*</excludedMethods>
D<excludedClasses>**/*Test*</excludedClasses>
Attempts:
2 left
💡 Hint
Look for the option that excludes classes by pattern.