Maven Surefire Plugin is used during test phase of build life cycle to execute the unit tests of an application. It has only one goal and it is 'test', runs the tests of the application. In test automation surefire plugin can be used for running functional tests from pom.xml.
Configure surefire plugin maven project:
In the Maven project open the pom.xml and add below plugin inside <build></build> tags.
Inclusion and Exclusion of Tests:
By default, the surefire plugin will include all test classes with the following wildcard patterns:
To specify the class we want to include to run the tests, we have to include it inside <includes></includes>.
Exclusion of Tests:
Similarly, if we want to exclude particular tests from the execution we can specify using surefire plugin as shown below.
To specify the class we want to exclude, we have to include it inside <excludes></excludes>.
These are some of the usages of Surefire plugin in Maven. Please comment your queries and suggestions on this topic. Thanks for reading!!
#seleniumbabu #HappyLearning #HappyTesting #qababu
Configure surefire plugin maven project:
In the Maven project open the pom.xml and add below plugin inside <build></build> tags.
Inclusion and Exclusion of Tests:
By default, the surefire plugin will include all test classes with the following wildcard patterns:
- "**/Test*.java" - includes all of its subdirectories and all Java filenames that start with "Test".
- "**/*Test.java" - includes all of its subdirectories and all Java filenames that end with "Test".
- "**/*Tests.java" - includes all of its subdirectories and all Java filenames that end with "Tests".
- "**/*TestCase.java" - includes all of its subdirectories and all Java filenames that end with "TestCase".
To specify the class we want to include to run the tests, we have to include it inside <includes></includes>.
Exclusion of Tests:
Similarly, if we want to exclude particular tests from the execution we can specify using surefire plugin as shown below.
To specify the class we want to exclude, we have to include it inside <excludes></excludes>.
These are some of the usages of Surefire plugin in Maven. Please comment your queries and suggestions on this topic. Thanks for reading!!
#seleniumbabu #HappyLearning #HappyTesting #qababu
No comments:
Post a Comment