Integration testing with client server application in Maven multi-modules project
You already figured out the basic steps yourself:
- create a separate module for integration tests
- start an application- or web-server (e.g.jetty) via a suitable maven-plugin (e.g. cargo, wildfly-maven-plugin, etc.) in the pre-integration-test phase
- run tests via the
maven-failsafe-plugin:integration-test
mojo - verify results via the
maven-failsafe-plugin:verify
mojo
Stephen Connolly, a maven developer, already wrote a great answer about this topic on stackoverflow.
I don't know the jetty-maven-plugin very well, but it seems it doesn't support deploying an existing artifact. Specifying relative or absolute path is definitively not the way to go here. You should probably use cargo instead to deploy to jetty. The cargo configuration could look like this:
<configuration> <configuration> <type>runtime</type> <properties> <cargo.hostname>testserver</cargo.hostname> <cargo.servlet.port>8080</cargo.servlet.port> </properties> </configuration> <container> <containerId>jetty9x</containerId> </container> <deployables> <deployable> <groupId>your.group.id</groupId> <artifactId>your-war</artifactId> <type>war</type> <properties> <context>/cmp</context> </properties> </deployable> </deployables> <deployer> <type>remote</type> </deployer></configuration>
The cargo documentation has more details.
hth,
- martin
Hello Jay,
Would really like to simplify things in here, why don't you run these jobs in succession? First would be your compile, unit-tests and deploy tasks using Maven. For your integration testing, create another job that would use of plugins like Selenium ( for your web application) and JMeter (for your web services). You can also try other license testing suite like Openscript.
The web service testing will be tricky, since your web service consumer runs on another client. Do you have any slave agents running on the client application? If you have one, run those jobs inside the slave.