Send a mail if the testcases fail. This is usefull if you have desided not to have the full build failing if your testcases fail (for any reason, usefull or not...).
The plugin computes the test results from the previous run of the mave-surefire-plugin, thefore the tests should have been executed.
This goal is able to send you the HTML report from the maven-surefire-report-plugin, but this is only possible if postman is executed after the report plugin. This can be achieved by setting the execution phase to site. If this is not the case, you will only receive a pure text mail.
The property groovyCondition allows you to redefine the condition to send the mail. e.g. one can define that there must not be more then 20 skipped test cases (skipped > 20). The default condition sends mails if there are any errors. The following variables are available for usage in the condition:
Other (usefull or not...) examples:
To avoid problems with XML syntax, one can use a CDATA element. The default only sends a mail if there are errors or failures, but ignores the skipped ones.
btw. with JUnit a test gets skipped if you add the @Ignore (org.junit.Ignore) annotation to it.
Default value is: errors > 0 || failures > 0
<build> .... <plugin> <groupId>ch.fortysix</groupId> <artifactId>maven-postman-plugin</artifactId> <configuration> <skip>false</skip> <from>builder@myhost.com</from> <failonerror>true</failonerror> <mailhost>mail.dummy.ch</mailhost> <mailuser>XXXXX</mailuser> <mailpassword>XXXXX</mailpassword> <receivers> <receiver>dev1</receiver> <receiver>dundy@youcomp.com</receiver> <receiver>dev2</receiver> </receivers> </configuration> <executions> <execution> <id>send surefire notification</id> <phase>site</phase> <goals> <goal>surefire-mail</goal> </goals> <configuration> <subject>Test Surefire</subject> <groovyCondition><![CDATA[errors < skipped]]></groovyCondition> <receivers> <receiver>1111</receiver> </receivers> </configuration> </execution> </executions> </plugin> .... </plugins> </build> <reporting> <plugins> .... <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-report-plugin</artifactId> <version>2.4.3</version> </plugin> .... </reporting>