SAGARFIVE

Tutorials

5.1 Maven test

  • Maven test is used to run unit test cases and integration test cases
  • Maven test has many commands
  • Maven has two different plugins related to tests.
  • maven-compiler-plugin, as its name suggests, handles compiling your code.
  • maven-surefire-plugin handles [unit] test execution and failing the build process if there are test failures
  • Maven-failsafe-plugin designed to run integration tests and as the name implies that when it fails, it does so in a safe way.
  • Failsafe and Surefire plugins are used to execute test cases in our maven based test automation frameworks.
  • We can also use JUnit (jJUnit unit 5) framework to run unit test cases by adding dependency and configuring JUnit at maven-surefire-plugin to run unit tests