0
0
JUnittesting~10 mins

Maven Surefire plugin 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 specify the Maven Surefire plugin version in the POM file.

JUnit
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <version>[1]</version>
</plugin>
Drag options to blanks, or click blank then click option'
A2.5
B1.0.0
C3.0.0-M7
D4.0.0
Attempts:
3 left
💡 Hint
Common Mistakes
Using outdated plugin versions like 1.0.0 or 2.5 which may not support JUnit 5.
2fill in blank
medium

Complete the code to configure Maven Surefire plugin to include only tests matching the pattern.

JUnit
<configuration>
  <includes>
    <include>[1]</include>
  </includes>
</configuration>
Drag options to blanks, or click blank then click option'
A**/*Test.java
B*.txt
Csrc/test/java
Dpom.xml
Attempts:
3 left
💡 Hint
Common Mistakes
Using file extensions or paths that do not match Java test files.
3fill in blank
hard

Fix the error in the Maven Surefire plugin configuration to enable JUnit 5 platform.

JUnit
<configuration>
  <[1]>
    <provider>org.junit.platform.surefire.provider.JUnitPlatformProvider</provider>
  </[1]>
</configuration>
Drag options to blanks, or click blank then click option'
AuseProvider
Bprovider
CproviderName
Dproviders
Attempts:
3 left
💡 Hint
Common Mistakes
Using singular tag directly without wrapping in .
4fill in blank
hard

Fill both blanks to configure Maven Surefire plugin to run tests with JUnit 5 and enable detailed reports.

JUnit
<configuration>
  <[1]>
    <[2]>org.junit.platform.surefire.provider.JUnitPlatformProvider</[2]>
  </[1]>
  <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
</configuration>
Drag options to blanks, or click blank then click option'
Aproviders
Bprovider
CuseJUnitPlatform
DreportFormat
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect tag names like or which are not valid here.
5fill in blank
hard

Fill all three blanks to configure Maven Surefire plugin to skip tests and set a custom test failure ignore flag.

JUnit
<configuration>
  <[1]>true</[1]>
  <[2]>false</[2]>
  <[3]>true</[3]>
</configuration>
Drag options to blanks, or click blank then click option'
AskipTests
BtestFailureIgnore
CforkCount
DfailIfNoTests
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing forkCount (which is a number) with boolean flags.
Setting testFailureIgnore to true when you want build to fail on test errors.