I have recently started migrating my project from ant to maven. I have two module in my application which I am able to build using maven.
Now I have automated tests project which use Web Driver for testing UI functionality. What I am trying to do using maven is to build both module wars and deploy them on to tomcat. Then run automation tests against them and pass the build if automation test passes. I have configured my pom like this(just mentioning important part):
<packaging>pom</packaging>
<modules>
<module>../module1</module>
<module>../module2</module>
</modules>
Now Both the projects get build and deploy but It doesn't run automation tests. The reason I thought is that packaging type is POM. But If I change it to war it starts throwing error.
I can think of creating third pom for automation and parent pom to include that as module also. But I am thinking whether this is a right way. It should be a very common scenario and maven should be supporting it directly.
(...) automation module is the WebDriver based automation tests for testing UI. It depends on web war but there is no package dependency. I am deploying to tomcat using cargo maven plugin. I want to build web wars from source, on the fly just before running the automation tests, then deploy on tomcat and then run tests. I can do all these using ant build but unable to using maven
This is definitely doable (and I've done it numerous time). But I'm not sure to understand your current project structure (especially, where the tests are located).
Here is the structure I suggest:
. ├── functests │ ├── pom.xml // here we configure maven to run cargo & it tests │ └── src │ └── it │ ├── java │ │ └── ... // functional tests will go here │ └── resources ├── pom.xml // aggregating pom └── mywebapp // the application under test ├── pom.xml └── src ├── main │ ├── java │ ├── resources │ └── webapp └── test ├── java └── resources
And for the details of the pom setup, have a look at Functional testing with Maven, Cargo and Selenium, it contains all the details required.