0
0
JUnittesting~5 mins

Maven Surefire plugin in JUnit - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the Maven Surefire plugin used for?
The Maven Surefire plugin runs unit tests during the build process. It helps check if your code works as expected before packaging.
Click to reveal answer
intermediate
How do you specify which tests to run with Maven Surefire?
You can use the includes and excludes tags in the plugin configuration to select test files by name patterns.
Click to reveal answer
beginner
What is the default test file naming pattern for Maven Surefire?
By default, Surefire runs tests matching **/Test*.java, **/*Test.java, and **/*Tests.java.
Click to reveal answer
beginner
How can you skip tests when running Maven build with Surefire?
You can skip tests by adding -DskipTests=true to the Maven command. This speeds up the build but skips test verification.
Click to reveal answer
beginner
What happens if a test fails during the Maven Surefire plugin execution?
If a test fails, Surefire marks the build as failed and stops the build process unless configured to continue.
Click to reveal answer
What is the main role of the Maven Surefire plugin?
ACompile Java source code
BRun unit tests during the build
CPackage the application
DDeploy the application
Which file naming pattern does Surefire use by default to find tests?
A**/Test*.java
B**/*.java
C**/Main*.java
D**/App*.java
How do you skip tests when running Maven with Surefire?
A-DskipTests=true
B-DrunTests=false
C-DnoTests=true
D-DdisableTests=true
If a test fails during Surefire execution, what happens by default?
ATests are rerun automatically
BBuild continues ignoring failures
CBuild fails and stops
DBuild succeeds with warnings
Where do you configure the Maven Surefire plugin?
AIn the src/test/resources folder
BIn the settings.xml file
CIn the .mvn folder
DIn the <build><plugins> section of pom.xml
Explain how Maven Surefire plugin helps in the software build process.
Think about what happens when you build your project and want to be sure your code works.
You got /4 concepts.
    Describe how to configure Maven Surefire plugin to run only specific tests.
    Focus on how to tell Surefire which tests to run or skip.
    You got /4 concepts.