Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the Maven verify command do?

It says in the documentation that the verify phase in the build lifecycle

run any checks on results of integration tests to ensure quality criteria are met

What does this exactly mean?

like image 759
kaka Avatar asked Dec 18 '18 21:12

kaka


People also ask

What is the difference between verify and test in Maven?

Based on official documentation: TEST - test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed. VERIFY - run any checks on results of integration tests to ensure quality criteria are met.

How do I verify mvn?

Verify is just another build lifecycle in maven so you can run it in command line from within the directory of your pom. xml file like any other maven command . If you want to run it from eclipse navigate to Run >> Run Configuration menu, select Maven build from left sidebar and make your own maven build.

Does Maven test do a clean?

To run all the unit tests with Maven run command $ mvn test or $ mvn clean test . If you use clean , all the resources and compiled java code generated by maven in target directory will be cleaned and run tests freshly.


1 Answers

The verify phase will indeed verify the integration tests results, if one or more results have failed or not.

How can you run those tests in your Maven?

Usually the maven-failsafe-plugin is used to orchestrate the lifecycle of the integration tests, it has two goals:

  1. failsafe:integration-test runs the integration tests of an application.
  2. failsafe:verify verifies that the integration tests of an application passed.

In the case of the verify goal, as per documentation:

Binds by default to the lifecycle phase: verify.

In the usage section of the documentation you can check some more discussion around the verify for each testing provider it is available

For this particular piece of configuration, the verify will check if some of summary files have any failures:

<execution> 
  <id>verify</id>
  <goals>
    <goal>verify</goal>
  </goals>
  <configuration>
    <summaryFiles>
      <summaryFile>target/failsafe-reports/failsafe-summary-red-bevels.xml</summaryFile>
      <summaryFile>target/failsafe-reports/failsafe-summary-no-bevels.xml</summaryFile>
    </summaryFiles>
  </configuration>
</execution>

Edit 1

Some interesting article can be found in here around the maven configuration for this.

like image 108
nortontgueno Avatar answered Oct 04 '22 14:10

nortontgueno