Given the following Maven Surefire plugin configuration snippet, which test classes will be executed by default?
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>3.0.0-M7</version> </plugin>
Think about the default naming patterns Surefire uses to find test classes.
By default, the Surefire plugin runs tests in classes matching patterns like **/Test*.java, **/*Test.java, and **/*Tests.java. It does not restrict to exact names or annotations unless configured.
Which assertion about the Maven Surefire and Failsafe plugins is correct?
Consider the Maven lifecycle phases and typical plugin usage.
Surefire is designed to run unit tests during the test phase, while Failsafe is intended for integration tests during the integration-test phase.
A developer notices that no tests run when executing mvn test even though test classes exist. The Surefire plugin is configured as below:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M7</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>What is the reason tests are not running?
Check the plugin configuration parameters related to skipping tests.
The skipTests configuration set to true tells Surefire to skip running tests during the build.
Which configuration is required to enable JUnit 5 tests to run with Maven Surefire plugin version 3.0.0-M7?
Think about the provider and dependencies needed for JUnit 5.
JUnit 5 requires the junit-jupiter-engine dependency and Surefire configured with the junitPlatform provider to run tests.
Which statement about configuring parallel test execution in Maven Surefire plugin is correct?
Consider the parallel modes Surefire supports.
Surefire supports parallel execution modes such as methods (parallel test methods in a class) and classes (parallel test classes). Setting parallel to methods runs methods in parallel.