Re: Need advice automating a Java test suite.
- Surefire is configured to run tests ending with IT after starting the Container and before stopping it again. You should use the failsafe plugin instead. It is specifically designed for ITs. /Anders Perhaps this helps. Chris Von: Todd Chapman t...@chaka.net Gesendet: Mittwoch, 8. Januar 2014 23:08 An: users@maven.apache.org Betreff: Need advice automating a Java test suite. Hello, We have a java multi-module project that has a somewhat painful to run test suite that I would like to get under control using Maven. Currently it takes 5 separate Maven commands to setup, run, and teardown all the tests and test databases. I'd like to get this down to one command. Also I would like this structured so that individual parts of the process can be run separately to aid in debugging problems. The pom has 1 profile for each part of the task, all bound to the test goal: mvn clean test -P test-setup-1,local-enterprise-test-db (exec:java plugin to setup up a database) mvn test -P test-setup-2,local-enterprise-test-db (exec:java plugin to setup up a 2nd database) mvn test -P test-design,local-enterprise-test-db(surefire plugin to run a subset of the tests with maven properties set) mvn test -P test-transactional,local-enterprise-test-db (surefire plugin to run a different subset of the tests with different maven properties set) mvn test -P test-tear-down,local-enterprise-test-db(exec:java plugin to teardown the databases) The problem I am running into is how to get this organized so that it all happens with 1 command. It seems nearly unpossible. Can anyone offer any advice on how to accomplish this? Pointer to relevant articles, blog posts, stackoverflow questions would be most appreciated. Thanks! -Todd - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Need advice automating a Java test suite.
Profiles are the path to madness. There are two ways I can see to tackle this: 1. Use the invoker plugin to fork maven builds for each of your test steps Or 2. Use a multi-module project so that the separate modules do the separate parts. The second is likely the more maven way but the 1st is not too far off, if done right, and probably the easiest to implement... Not too hard to refactor to #2 if you decide to later On Wednesday, 8 January 2014, Todd Chapman wrote: Hello, We have a java multi-module project that has a somewhat painful to run test suite that I would like to get under control using Maven. Currently it takes 5 separate Maven commands to setup, run, and teardown all the tests and test databases. I'd like to get this down to one command. Also I would like this structured so that individual parts of the process can be run separately to aid in debugging problems. The pom has 1 profile for each part of the task, all bound to the test goal: mvn clean test -P test-setup-1,local-enterprise-test-db (exec:java plugin to setup up a database) mvn test -P test-setup-2,local-enterprise-test-db (exec:java plugin to setup up a 2nd database) mvn test -P test-design,local-enterprise-test-db(surefire plugin to run a subset of the tests with maven properties set) mvn test -P test-transactional,local-enterprise-test-db (surefire plugin to run a different subset of the tests with different maven properties set) mvn test -P test-tear-down,local-enterprise-test-db(exec:java plugin to teardown the databases) The problem I am running into is how to get this organized so that it all happens with 1 command. It seems nearly unpossible. Can anyone offer any advice on how to accomplish this? Pointer to relevant articles, blog posts, stackoverflow questions would be most appreciated. Thanks! -Todd -- Sent from my phone
RE: Need advice automating a Java test suite.
Date: Wed, 8 Jan 2014 17:08:53 -0500 Subject: Need advice automating a Java test suite. From: t...@chaka.net To: users@maven.apache.org Hello, We have a java multi-module project that has a somewhat painful to run test suite that I would like to get under control using Maven. Currently it takes 5 separate Maven commands to setup, run, and teardown all the tests and test databases. I'd like to get this down to one command. Also I would like this structured so that individual parts of the process can be run separately to aid in debugging problems. The pom has 1 profile for each part of the task, all bound to the test goal: MGMy initial thought was to bind each profile-group to different phases MGthat way the reactor will govern the execution order of who gets executed first (mvn initialize), MGwhich profile gets executed second (mvn generate-test-sources) MGand finally last profile gets executed (mvn package) MGthe problem is you have alot of testcases to run so perhaps running a string of profiles maybe the answer MGProfile1 mvn clean test -P test-setup-1,local-enterprise-test-db (exec:java plugin to setup up a database) mvn test -P test-setup-2,local-enterprise-test-db (exec:java plugin to setup up a 2nd database) MGProfile1 MGProfile2 mvn test -P test-design,local-enterprise-test-db (surefire plugin to run a subset of the tests with maven properties set) mvn test -P test-transactional,local-enterprise-test-db (surefire plugin to run a different subset of the tests with different maven properties set) MGProfile2 MGProfile3 mvn test -P test-tear-down,local-enterprise-test-db (exec:java plugin to teardown the databases) MGProfile3 MGOff the top of my head i would setup a 'marker file' for the successful completion of each Profile MGWhen marker file from Profile1 exists trigger Profile 2 MGWhen marker file from Profile2 exists trigger Profile3 MGmvn help:active-profiles -P Profile1,Profile2,Profile3 The problem I am running into is how to get this organized so that it all happens with 1 command. It seems nearly unpossible. Can anyone offer any advice on how to accomplish this? Pointer to relevant articles, blog posts, stackoverflow questions would be most appreciated. Thanks! -Todd MGassuming the IDentifiers are unique (and presence of marker files are unique) synchronous profile execution *should* work
Re: Need advice automating a Java test suite.
It's little bit hard understanding all of the magic with your profiles and why you can''t combine them. But if I assume that you want to test your application with different configuration (different db, different configuration/properties, etc.) I suggest that you create a separate multi-module project for your testing. Each of the modules there would test ONE specific setup/config for the applicatation. You would bind the setup of the environment to the pre-integration-test phase and the tear down of the same to the post-integration-test phase. And then you use the maven-failsafe-plugin to execute all tests (for that app config) in the integration-test phase. If you have the same set of JUnit test classes to be used in all modules, you have these in a separate module which would create a test artifact that you re-use in the other modules. If you have a lot of the same pom config magics in the modules this can be moved to the pluginManagement section of the parent (more advanced Maven usage, do that last when everything already works). This will make it possible to build all modules for a complete test suite (mvn verify). If you just want to test one setup/config you only build that module (mvn verify). /Anders On Wed, Jan 8, 2014 at 11:08 PM, Todd Chapman t...@chaka.net wrote: Hello, We have a java multi-module project that has a somewhat painful to run test suite that I would like to get under control using Maven. Currently it takes 5 separate Maven commands to setup, run, and teardown all the tests and test databases. I'd like to get this down to one command. Also I would like this structured so that individual parts of the process can be run separately to aid in debugging problems. The pom has 1 profile for each part of the task, all bound to the test goal: mvn clean test -P test-setup-1,local-enterprise-test-db (exec:java plugin to setup up a database) mvn test -P test-setup-2,local-enterprise-test-db (exec:java plugin to setup up a 2nd database) mvn test -P test-design,local-enterprise-test-db(surefire plugin to run a subset of the tests with maven properties set) mvn test -P test-transactional,local-enterprise-test-db (surefire plugin to run a different subset of the tests with different maven properties set) mvn test -P test-tear-down,local-enterprise-test-db(exec:java plugin to teardown the databases) The problem I am running into is how to get this organized so that it all happens with 1 command. It seems nearly unpossible. Can anyone offer any advice on how to accomplish this? Pointer to relevant articles, blog posts, stackoverflow questions would be most appreciated. Thanks! -Todd