what does mvn verify command do?

kaka picture kaka · Dec 18, 2018 · Viewed 13.9k times · Source

It says on this site 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?

Answer

nullptr picture nullptr · Dec 19, 2018

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.