0
0
JUnittesting~10 mins

Mutation testing concept (PIT) in JUnit - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to run a basic PIT mutation test with JUnit.

JUnit
MutationCoverage coverage = new MutationCoverageBuilder().withTestPlugin("[1]")
Drag options to blanks, or click blank then click option'
Amockito
Btestng
Cspock
Djunit
Attempts:
3 left
💡 Hint
Common Mistakes
Using a plugin name for a different testing framework like TestNG or Spock.
2fill in blank
medium

Complete the code to specify the target classes for mutation testing.

JUnit
PitStrategy strategy = new PitStrategy().withTargetClasses("[1]")
Drag options to blanks, or click blank then click option'
Acom.example.*
Bcom.pit.*
Cjava.util.*
Dorg.junit.*
Attempts:
3 left
💡 Hint
Common Mistakes
Targeting external libraries like JUnit or Java standard packages.
3fill in blank
hard

Fix the error in the PIT configuration code to correctly set the mutators.

JUnit
PitStrategy strategy = new PitStrategy().withMutators("[1]")
Drag options to blanks, or click blank then click option'
Adefault
Ball
CDEFAULTS
Dmutate
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase or incorrect mutator names causes configuration errors.
4fill in blank
hard

Fill both blanks to configure PIT to exclude test classes and set the output format.

JUnit
PitStrategy strategy = new PitStrategy().withExcludedClasses("[1]*").withOutputFormats("[2]")
Drag options to blanks, or click blank then click option'
ATest
BHTML
CSpec
DXML
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong patterns for exclusion or unsupported output formats.
5fill in blank
hard

Fill all three blanks to create a mutation test run with PIT using JUnit, targeting your package, and setting mutators.

JUnit
PitStrategy strategy = new PitStrategy().withTestPlugin("[1]")
.withTargetClasses("[2]*")
.withMutators("[3]")
Drag options to blanks, or click blank then click option'
Ajunit
Bcom.myapp
CDEFAULTS
Dtestng
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing test plugins or using incorrect package names or mutator sets.