AssertJ custom Aspects doesn't work with maven-surefire-plugin - maven

I have the maven project written on Kotlin.
pom.xml uses maven-surefire-plugin plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<suiteXmlFiles>
<suiteName>${suiteName}</suiteName>
</suiteXmlFiles>
<testFailureIgnore>false</testFailureIgnore>
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
</argLine>
<systemPropertyVariables>
<env>${env}</env>
<deviceName>${deviceName}</deviceName>
</systemPropertyVariables>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
I'd like to add additional aspect to my code, so I added another plugin:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.14.0</version>
<configuration>
<complianceLevel>1.8</complianceLevel>
<source>1.8</source>
<target>1.8</target>
<showWeaveInfo>true</showWeaveInfo>
<verbose>true</verbose>
<Xlint>ignore</Xlint>
<encoding>${project.build.sourceEncoding}</encoding>
<forceAjcCompile>true</forceAjcCompile>
<weaveDirectories>
<weaveDirectory>${project.build.outputDirectory}</weaveDirectory>
<weaveDirectory>${project.build.testOutputDirectory}</weaveDirectory>
</weaveDirectories>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
with aspectjrt dependency.
In this state, my tests are working.
Next, I created a new class with #Aspect annotation - still working.
Now I am adding very simple code (just to check) in this class:
#Pointcut("execution(* *(..))")
fun method() {
}
#AfterReturning(pointcut = "method()")
fun afterMethod() {
println("After method")
}
This causes suite to fail with:
[ERROR] There was an error in the forked process
[ERROR] 'utils.Aspects utils.Aspects.aspectOf()'
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process
[ERROR] 'utils.Aspects utils.Aspects.aspectOf()'
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:656)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:282)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:245)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1183)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1011)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:857)
[ERROR] at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:301)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:211)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:165)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:157)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:121)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
[ERROR] at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:127)
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:294)
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
[ERROR] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
[ERROR] at org.apache.maven.cli.MavenCli.execute(MavenCli.java:960)
[ERROR] at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:293)
[ERROR] at org.apache.maven.cli.MavenCli.main(MavenCli.java:196)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
[ERROR] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.base/java.lang.reflect.Method.invoke(Method.java:564)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
I have created stand-alone project to check if understand AOP concept correctly here: https://github.com/heavy-razzer/AssertJ-Maven-Kotlin
It work.
So looks like there is something wrong with the configuration of my main project, but what?

I just cloned your sample project, which was verfy helpful. For me, the project works just fine in Maven:
[INFO] --- aspectj-maven-plugin:1.14.0:test-compile (default) # aop-project-kotlin ---
(...)
[INFO] Join point 'method-execution(void tests.NewTest.myTest())' in Type 'tests.NewTest' (NewTest.kt:12) advised by before advice from 'Aspects' (test-classes!Aspects.class(from Aspects.kt))
[INFO] Join point 'method-execution(void steps.Steps.printCaption())' in Type 'steps.Steps' (Steps.kt:7) advised by afterReturning advice from 'Aspects' (test-classes!Aspects.class(from Aspects.kt))
[INFO] Join point 'method-execution(void steps.Steps.printMessage())' in Type 'steps.Steps' (Steps.kt:11) advised by afterReturning advice from 'Aspects' (test-classes!Aspects.class(from Aspects.kt))
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) # aop-project-kotlin ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running tests.NewTest
Test started: Very simple test
This this a simple test
Test step performed: printCaption
Testing in progress
Test step performed: printMessage
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.592 s - in tests.NewTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
In IntelliJ IDEA, it does not work out of the box, because doing post-compile weaving with Maven in a single module together with Kotlin compilation does not work out of the box. The test runs, but the aspect is not triggered. You need to delegate the build and run actions to Maven to be able to run the test directly from IDEA:
Test started: Very simple test
This this a simple test
Test step performed: printCaption
Testing in progress
Test step performed: printMessage
===============================================
Default Suite
Total tests run: 1, Failures: 0, Skips: 0
===============================================
Under no circumstances, however, can I reproduce your Maven problem.

The problem in my main project (not that sample project I shared here) lies in qase-testng library that I use to upload test run results to the Qase Test Management system.
me and Qase use AssertJ and have aspects logic implemented in some classes
Qase requires some additional configuration to SureFire maven plugin to upload all test data correctly.
SureFire uses AssertJ too
And when I run my project, SureFire got exceptions when trying to combine Aspects from my code and from Qase library.
Workaround is:
Remove argLine from SureFire config (from Qase testing docs)
Remove goal "compile" from aspectj-maven-plugin config - it is not needed for a project with tests.
The only drawback of these actions is that step names in the Qase dashboard will not have green/red icons next to them in the test run page. I have contacted Qase support, and they are thinking about this situation.

Related

Getting a java.lang.IllegalArgumentException when updating cucumber-groovy version in POM file

I'm getting the following exception when updating the cucumber-groovy version in my POM file from 4.2.0 to 4.7.0
java.lang.IllegalArgumentException: The glue path contained invalid identifiers target/test-classes
at io.cucumber.core.model.GluePath.parseAssumeClasspathScheme (GluePath.java:84)
at io.cucumber.core.model.GluePath.parse (GluePath.java:53)
at io.cucumber.core.options.RuntimeOptionsParser.parse (RuntimeOptionsParser.java:85)
at io.cucumber.core.options.CommandlineOptionsParser.parse (CommandlineOptionsParser.java:25)
at io.cucumber.core.options.CommandlineOptionsParser.parse (CommandlineOptionsParser.java:29)
at io.cucumber.core.cli.Main.run (Main.java:29)
at io.cucumber.core.cli.Main.main (Main.java:14)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:282)
at java.lang.Thread.run (Thread.java:748)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.329 s
[INFO] Finished at: 2019-10-28T19:17:41+11:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:java (default) on project sample-test: An exception occured while executing the Java class. The glue path contained invalid identifiers target/test-classes -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
This is the section of POM file where the error is being generated from (I believe)
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${exec-maven-plugin.version}</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<classpathScope>test</classpathScope>
<mainClass>io.cucumber.core.cli.Main</mainClass> <!-- NEEDED FOR cucumber-groovy version 4.7.1 -->
<!--<mainClass>cucumber.api.cli.Main</mainClass>--> <!-- NEEDED FOR cucumber-groovy version 4.2.0 -->
<arguments>
<argument>--plugin</argument>
<argument>json:reports/junit.json</argument>
<argument>--strict</argument>
<argument>--glue</argument>
<argument>target/test-classes</argument>
<argument>target/test-classes/.</argument>
<argument>--tags</argument>
<argument>${tagArg}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
And here is the properties section of the POM file
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<cluecumber-report-plugin.version>2.3.1</cluecumber-report-plugin.version>
<exec-maven-plugin.version>1.6.0</exec-maven-plugin.version>
<maven-clean-plugin.version>3.1.0</maven-clean-plugin.version>
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
<ocular.version>1.0.0.Alpha</ocular.version>
<groovycsv.version>1.3</groovycsv.version>
<ashot.version>1.5.4</ashot.version>
<webdrivermanager.version>3.7.1</webdrivermanager.version>
<com4j.version>2.1</com4j.version>
<geb-core.version>3.2</geb-core.version>
<http-builder.version>0.7.1</http-builder.version>
<commons-io.version>2.6</commons-io.version>
<selenium-api.version>3.141.59</selenium-api.version>
<selenium-java.version>3.141.59</selenium-java.version>
<slf4j-simple.version>1.7.28</slf4j-simple.version>
<cucumber-jvm.version>4.8.0</cucumber-jvm.version>
<cucumber-groovy.version>4.7.0</cucumber-groovy.version>
<groovy-all.version>2.5.8</groovy-all.version>
</properties>
Same POM file works fine when using the cucumber-groovy version 4.2.0, is there a different way to specify the glue code for newer version of cucumber-groovy?
I have tried using the following but none of them worked.
target.test-classes
target
test-classes
My folder structure is
src\test\resources\features
src\test\resources\step_definitions
Any help is highly appreciated.
Thanks!
You currently pass your glue as --glue target/test-classes target/test-classes/. However your glue should be either a package name or class path uri. To access resources in the nameless package you can use --glue classpath: instead.
update POM file and replace
--glue target/test-classes target/test-classes/.
with
--glue classpath: classpath:/.

Build Failure during deploying maven project to heroku

I am trying to deploy maven project to heroku but it is showing error.
[INFO] Webapp assembled in [765 msecs]
[INFO] Building war:
C:\Users\Lenovo\Documents\GitHub\MakeMyEvent\target\MakeMyEvent-0.0.1-SNAPSHOT.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.406 s
[INFO] Finished at: 2018-08-23T16:16:19+05:30
[INFO] Final Memory: 16M/90M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-
plugin:2.2:war (default-war) on project MakeMyEvent: Error assembling WAR:
webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
it is a jsp project and working fine on my local machine.
As per the information you have provided here, your war building triggers the error.
basically if you are using maven war plugin try considering adding <failOnMissingWebXml>false</failOnMissingWebXml>
Example :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>

Error Maven with mvn test

I am using this tool for first time, and I can't build a project correctly.
when i try the life cycle commands it builds succesfully with clean validate and compile. but when i try mvn test, it gives me this error :
[INFO] ---------------------------------------------------------------------
---
[INFO] BUILD FAILURE
[INFO] ---------------------------------------------------------------------
---
[INFO] Total time: 4.410 s
[INFO] Finished at: 2018-05-25T11:33:07+02:00
[INFO] ---------------------------------------------------------------------
---
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-
plugin:2.20.1:test (default-test) on project gdp: Execution default-test of
goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test failed.
:NullPointerException
-> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please
read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
mvn -v 3.5.3
i am using a proxy and i did configure settings.xml file
Please help.
thank you
Change the version of maven-surefire-plugin via:
<project>
.
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

Maven spring boot pre-integration-test timeout error

When I run the command install of my server's Lifecycle I get the following error:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 34.507 s
[INFO] Finished at: 2017-03-10T15:32:41+01:00
[INFO] Final Memory: 69M/596M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.4.0.RELEASE:start (pre-integration-test) on project challenger-server-boot: Spring application did not start before the configured timeout (30000ms -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
It obviously comes from the timeout settings but I cannot find where I have to change this value...
Not sure if it can help but here's some of my pom.xml related to the unit and integration testings:
<!-- Unit testing -->
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<!-- Integration testing -->
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<skipTests>false</skipTests>
</configuration>
</plugin>
Here's the debug log: http://pastebin.com/kUkufHFS
You are trying to start a spring boot app before in pre-integration-test phase.
The spring-boot-maven-plugin StartMojo class (org.springframework.boot.maven) is complaining because the app is not started within the default timeout, wich is defined by the attributes "wait" (defautl value: 500 ms) and "maxAttempts" (default: 60) -> 500 * 60.
/**
* The number of milli-seconds to wait between each attempt to check if the spring
* application is ready.
*/
#Parameter
private long wait = 500;
/**
* The maximum number of attempts to check if the spring application is ready.
* Combined with the "wait" argument, this gives a global timeout value (30 sec by
* default)
*/
#Parameter
private int maxAttempts = 60;
"wait" and "maxAttempts" are annotated #Parameter, which means you can change their value from within your pom file, in the plugin configuration like this:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<wait>1000</wait>
<maxAttempts>180</maxAttempts>
</configuration>
<executions>
...
</executions>
</plugin>

How do I prevent Maven from assmebling my WAR if my integration tests fail?

I’m using Maven 3.3.3 with Java 8 on Mac Yosemite. I have a bunch of integration tests and I have my failsafe plugin (v 2.18.1) set up as such …
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<reuseForks>true</reuseForks>
<argLine>-Xmx4096m -XX:MaxPermSize=512M -noverify -XX:-UseSplitVerifier ${itCoverageAgent}</argLine>
<skipTests>${skipAllTests}</skipTests>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
However, when I run the command “mvn clean install,” even when I have failed unit tests, the build continues on to assembling the war. How do I prevent further Maven activity if I have failed integration tests? Below is example output of what I’m seeing. Note that the WAR plugin continues to run even after the tests have failed.
Results :
Failed tests:
MyProjectInstantLoginControllerIT.testInstantLoginSuccessNoCredentailsObj:245 View name is not equal to 'redirect:http://localhost:80/authenticate' but was 'redirect:http://localhost:80/home'
MyProjectInstantLoginControllerIT.testInstantLoginSuccessStudent:153 View name is not equal to 'redirect:http://localhost:80/authenticate' but was 'redirect:http://localhost:80/home'
MyProjectInstantLoginControllerIT.testInstantLoginSuccessTeacher:125 View name is not equal to 'redirect:http://localhost:80/authenticate' but was 'redirect:http://localhost:80/home'
MyProjectInstantLoginControllerIT.testInstantLoginSuccessWithApacheHeader:187 View name is not equal to 'redirect:http://localhost:80/authenticate' but was 'redirect:http://localhost:80/home'
Tests in error:
ClassController2IT.testUpdateClassWoSchedule:478->AbstractClassControllerTest.submitCreateClassForm:514 » LazyInitialization
Tests run: 157, Failures: 4, Errors: 1, Skipped: 4
[INFO]
[INFO] --- maven-war-plugin:2.6:war (default-war) # my-module ---
[INFO] Packaging webapp
[INFO] Assembling webapp [my-module] in [/Users/davea/Documents/my_workspace/my-module/target/my-module]
[INFO] Dependency [Dependency {groupId=org.mainco.subco, artifactId=second-module, version=87.0.0-SNAPSHOT, type=jar}] has changed (was Dependency {groupId=org.mainco.subco, artifactId=second-module, version=87.0.0-SNAPSHOT, type=jar}).
[WARNING] File to remove [/Users/davea/Documents/my_workspace/my-module/target/my-module/WEB-INF/lib/second-module-87.0.0-SNAPSHOT.jar] has not been found
[INFO] Dependency [Dependency {groupId=org.springframework, artifactId=spring-core, version=3.2.11.RELEASE, type=jar}] has changed (was Dependency {groupId=org.springframework, artifactId=spring-core, version=3.2.11.RELEASE, type=jar}).
[WARNING] File to remove [/Users/davea/Documents/my_workspace/my-module/target/my-module/WEB-INF/lib/spring-core-3.2.11.RELEASE.jar] has not been found
[INFO] Dependency [Dependency {groupId=org.springframework.security.extensions, artifactId=spring-security-saml2-core, version=1.0.0.RC2, type=jar}] has changed (was Dependency {groupId=org.springframework.security.extensions, artifactId=spring-security-saml2-core, version=1.0.0.RC2, type=jar}).
[WARNING] File to remove [/Users/davea/Documents/my_workspace/my-module/target/my-module/WEB-INF/lib/spring-security-saml2-core-1.0.0.RC2.jar] has not been found
[INFO] Dependency [Dependency {groupId=org.opensaml, artifactId=opensaml, version=2.6.1, type=jar}] has changed (was Dependency {groupId=org.opensaml, artifactId=opensaml, version=2.6.1, type=jar}).
[WARNING] File to remove [/Users/davea/Documents/my_workspace/my-module/target/my-module/WEB-INF/lib/opensaml-2.6.1.jar] has not been found
[INFO] Processing war project
[INFO] Copying webapp resources [/Users/davea/Documents/my_workspace/my-module/src/main/webapp]
[INFO] Webapp assembled in [5454 msecs]
[INFO] Building war: /Users/davea/Documents/my_workspace/my-module/target/my-module.war
[INFO]
[INFO] --- maven-failsafe-plugin:2.18.1:verify (default) # my-module ---
[INFO] Failsafe report directory: /Users/davea/Documents/my_workspace/my-module/target/failsafe-reports
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:17 min
[INFO] Finished at: 2015-11-09T11:23:47-06:00
[INFO] Final Memory: 48M/792M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.18.1:verify (default) on project my-module: There are test failures.
[ERROR]
[ERROR] Please refer to /Users/davea/Documents/my_workspace/my-module/target/failsafe-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
You haven't specified any phase(s) you want failsafe plugin to run its goals on. By default, the goals integration-test and verify are bound to the integration-test and verify phases of the default life cycle.
Recall that these phases occur after the package phase is complete (refer the life cycle references), so with the configuration you have, you are not impacting the package phase in any way - your goals run after the package phase (i.e the goals set to run in that phase - the maven-war-plugin:2.6:war being one) is complete.
You could try running the integration tests and verifying them before the package phase if that's what you really want by specifying the appropriate phase(s) for your goals in the <execution> you've shown in your OP.
Unrelated to the problem, the maven-failsafe-plugin plugin is intended to target integration tests and decouple the build failures from the actual integration test results. You get around it by verifying your integration test results.
Here's a quote from the FAQ:
What is the difference between maven-failsafe-plugin and
maven-surefire-plugin?
maven-surefire-plugin is designed for running unit tests and if any of the tests fail then it will fail the build immediately.
maven-failsafe-plugin is designed for running integration tests, and decouples failing the build if there are test failures from
actually running the tests.
Further notes on this subject:
If you use the Surefire Plugin for running tests, then when you have a
test failure, the build will stop at the integration-test phase and
your integration test environment will not have been torn down
correctly.
The Failsafe Plugin is used during the integration-test and verify
phases of the build lifecycle to execute the integration tests of an
application. The Failsafe Plugin will not fail the build during the
integration-test phase, thus enabling the post-integration-test phase
to execute.

Resources