Re: Separating Integration and Unit Tests
And put your integration tests in another module, that way it can depend upon the completed results of what you want to integrate and you wont have to muck around with separating your unit tests from it (since you will *only* have integration tests in this module) On 2 January 2015 at 13:55, Benson Margulies bimargul...@gmail.com wrote: I think that what you actually want is two executions of surefire (or one of surefire and one of failsafe) with different test name patterns. On Thu, Jan 1, 2015 at 2:40 PM, Ole Ersoy ole.er...@gmail.com wrote: Hi, I'm attempting to separate my integration and unit tests using profiles and the maven build helper plugin. I have unit tests in the standard directory and integration tests in `src/integration-test/java`. When I run the default profile, I expect integration tests to be skipped and unit tests to be executed. When I run the `integration-test` profile with `mvn clean test -Pintegration-test` I expect the integration tests to be run and the unit tests to be skipped. Right now Maven is just ignoring the profile test settings: `skip.integration.tests` `skip.unit.tests` and it just runs all the tests regardless of which profile is active. My POM looks like this: project xmlns=http://maven.apache.org/POM/4.0.0; xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; modelVersion4.0.0/modelVersion groupIdcom.example.maven/groupId artifactIdseparating-integration-and-unit-test-execution/artifactId version1.0.0/version profiles profile idunit-test/id activation activeByDefaulttrue/activeByDefault /activation properties skip.integration.teststrue/skip.integration.tests skip.unit.testsfalse/skip.unit.tests /properties /profile profile idintegration-test/id properties skip.integration.testsfalse/skip.integration.tests skip.unit.teststrue/skip.unit.tests /properties /profile /profiles build plugins plugin groupIdorg.codehaus.mojo/groupId artifactIdbuild-helper-maven-plugin/artifactId version1.9.1/version executions !-- Add the integration-test source directory -- execution idadd-integration-test-sources/id phasegenerate-test-sources/phase goals goaladd-test-source/goal /goals configuration sources sourcesrc/integration-test/java/source /sources /configuration /execution /executions /plugin /build /project Thoughts? TIA, - Ole - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org -- Buy your books from me and Book Depository at http://www.users.on.net/~baerrach/ Commissions go to http://www.plan.org.au/
Re: Separating Integration and Unit Tests
I think that what you actually want is two executions of surefire (or one of surefire and one of failsafe) with different test name patterns. On Thu, Jan 1, 2015 at 2:40 PM, Ole Ersoy ole.er...@gmail.com wrote: Hi, I'm attempting to separate my integration and unit tests using profiles and the maven build helper plugin. I have unit tests in the standard directory and integration tests in `src/integration-test/java`. When I run the default profile, I expect integration tests to be skipped and unit tests to be executed. When I run the `integration-test` profile with `mvn clean test -Pintegration-test` I expect the integration tests to be run and the unit tests to be skipped. Right now Maven is just ignoring the profile test settings: `skip.integration.tests` `skip.unit.tests` and it just runs all the tests regardless of which profile is active. My POM looks like this: project xmlns=http://maven.apache.org/POM/4.0.0; xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; modelVersion4.0.0/modelVersion groupIdcom.example.maven/groupId artifactIdseparating-integration-and-unit-test-execution/artifactId version1.0.0/version profiles profile idunit-test/id activation activeByDefaulttrue/activeByDefault /activation properties skip.integration.teststrue/skip.integration.tests skip.unit.testsfalse/skip.unit.tests /properties /profile profile idintegration-test/id properties skip.integration.testsfalse/skip.integration.tests skip.unit.teststrue/skip.unit.tests /properties /profile /profiles build plugins plugin groupIdorg.codehaus.mojo/groupId artifactIdbuild-helper-maven-plugin/artifactId version1.9.1/version executions !-- Add the integration-test source directory -- execution idadd-integration-test-sources/id phasegenerate-test-sources/phase goals goaladd-test-source/goal /goals configuration sources sourcesrc/integration-test/java/source /sources /configuration /execution /executions /plugin /build /project Thoughts? TIA, - Ole - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Separating Integration and Unit Tests
A much simpler way would be to end your integration tests in IT instead of Test and then have failsafe run the tests for you. Much less hacky On 1 January 2015 at 19:40, Ole Ersoy ole.er...@gmail.com wrote: Hi, I'm attempting to separate my integration and unit tests using profiles and the maven build helper plugin. I have unit tests in the standard directory and integration tests in `src/integration-test/java`. When I run the default profile, I expect integration tests to be skipped and unit tests to be executed. When I run the `integration-test` profile with `mvn clean test -Pintegration-test` I expect the integration tests to be run and the unit tests to be skipped. Right now Maven is just ignoring the profile test settings: `skip.integration.tests` `skip.unit.tests` and it just runs all the tests regardless of which profile is active. My POM looks like this: project xmlns=http://maven.apache.org/POM/4.0.0; xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; modelVersion4.0.0/modelVersion groupIdcom.example.maven/groupId artifactIdseparating-integration-and-unit-test-execution/artifactId version1.0.0/version profiles profile idunit-test/id activation activeByDefaulttrue/activeByDefault /activation properties skip.integration.teststrue/skip.integration.tests skip.unit.testsfalse/skip.unit.tests /properties /profile profile idintegration-test/id properties skip.integration.testsfalse/skip.integration.tests skip.unit.teststrue/skip.unit.tests /properties /profile /profiles build plugins plugin groupIdorg.codehaus.mojo/groupId artifactIdbuild-helper-maven-plugin/artifactId version1.9.1/version executions !-- Add the integration-test source directory -- execution idadd-integration-test-sources/id phasegenerate-test-sources/phase goals goaladd-test-source/goal /goals configuration sources sourcesrc/integration-test/java/source /sources /configuration /execution /executions /plugin /build /project Thoughts? TIA, - Ole - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Separating Integration and Unit Tests
Hi, I'm attempting to separate my integration and unit tests using profiles and the maven build helper plugin. I have unit tests in the standard directory and integration tests in `src/integration-test/java`. When I run the default profile, I expect integration tests to be skipped and unit tests to be executed. When I run the `integration-test` profile with `mvn clean test -Pintegration-test` I expect the integration tests to be run and the unit tests to be skipped. Right now Maven is just ignoring the profile test settings: `skip.integration.tests` `skip.unit.tests` and it just runs all the tests regardless of which profile is active. My POM looks like this: project xmlns=http://maven.apache.org/POM/4.0.0; xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; modelVersion4.0.0/modelVersion groupIdcom.example.maven/groupId artifactIdseparating-integration-and-unit-test-execution/artifactId version1.0.0/version profiles profile idunit-test/id activation activeByDefaulttrue/activeByDefault /activation properties skip.integration.teststrue/skip.integration.tests skip.unit.testsfalse/skip.unit.tests /properties /profile profile idintegration-test/id properties skip.integration.testsfalse/skip.integration.tests skip.unit.teststrue/skip.unit.tests /properties /profile /profiles build plugins plugin groupIdorg.codehaus.mojo/groupId artifactIdbuild-helper-maven-plugin/artifactId version1.9.1/version executions !-- Add the integration-test source directory -- execution idadd-integration-test-sources/id phasegenerate-test-sources/phase goals goaladd-test-source/goal /goals configuration sources sourcesrc/integration-test/java/source /sources /configuration /execution /executions /plugin /build /project Thoughts? TIA, - Ole - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Separating Integration and Unit Tests
On Thu, Jan 1, 2015 at 5:29 PM, Ole Ersoy ole.er...@gmail.com wrote: Had one more question. In the documentation I have read the integration test directory is usually added in the generate-test-sources phase. So all tests are visible during the `test` phase, although they would be excluded by default if they end in `IT`. Where is this documentation? It seems more Logical to add the integration test directory during the `pre-integration-test` phase, but I don't think that's what the Maven documentation does. Are there any drawbacks to doing this? Thanks, - Ole - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Separating Integration and Unit Tests
Had one more question. In the documentation I have read the integration test directory is usually added in the generate-test-sources phase. So all tests are visible during the `test` phase, although they would be excluded by default if they end in `IT`. It seems more Logical to add the integration test directory during the `pre-integration-test` phase, but I don't think that's what the Maven documentation does. Are there any drawbacks to doing this? Thanks, - Ole - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Separating Integration and Unit Tests
Hi Benson, I got it working now. I wanted to be able to run the build with an integration test profile that skips running the unit tests: `mvn clean verify -P integration-test` Its working now. Thanks, - Ole On 01/01/2015 09:25 PM, Benson Margulies wrote: I think that what you actually want is two executions of surefire (or one of surefire and one of failsafe) with different test name patterns. On Thu, Jan 1, 2015 at 2:40 PM, Ole Ersoy ole.er...@gmail.com wrote: Hi, I'm attempting to separate my integration and unit tests using profiles and the maven build helper plugin. I have unit tests in the standard directory and integration tests in `src/integration-test/java`. When I run the default profile, I expect integration tests to be skipped and unit tests to be executed. When I run the `integration-test` profile with `mvn clean test -Pintegration-test` I expect the integration tests to be run and the unit tests to be skipped. Right now Maven is just ignoring the profile test settings: `skip.integration.tests` `skip.unit.tests` and it just runs all the tests regardless of which profile is active. My POM looks like this: project xmlns=http://maven.apache.org/POM/4.0.0; xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; modelVersion4.0.0/modelVersion groupIdcom.example.maven/groupId artifactIdseparating-integration-and-unit-test-execution/artifactId version1.0.0/version profiles profile idunit-test/id activation activeByDefaulttrue/activeByDefault /activation properties skip.integration.teststrue/skip.integration.tests skip.unit.testsfalse/skip.unit.tests /properties /profile profile idintegration-test/id properties skip.integration.testsfalse/skip.integration.tests skip.unit.teststrue/skip.unit.tests /properties /profile /profiles build plugins plugin groupIdorg.codehaus.mojo/groupId artifactIdbuild-helper-maven-plugin/artifactId version1.9.1/version executions !-- Add the integration-test source directory -- execution idadd-integration-test-sources/id phasegenerate-test-sources/phase goals goaladd-test-source/goal /goals configuration sources sourcesrc/integration-test/java/source /sources /configuration /execution /executions /plugin /build /project Thoughts? TIA, - Ole - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Separating Integration and Unit Tests
On 01/01/2015 09:26 PM, Benson Margulies wrote: On Thu, Jan 1, 2015 at 5:29 PM, Ole Ersoy ole.er...@gmail.com wrote: Had one more question. In the documentation I have read the integration test directory is usually added in the generate-test-sources phase. So all tests are visible during the `test` phase, although they would be excluded by default if they end in `IT`. Where is this documentation? Here: http://mojo.codehaus.org/build-helper-maven-plugin/usage.html It seems more Logical to add the integration test directory during the `pre-integration-test` phase, but I don't think that's what the Maven documentation does. Are there any drawbacks to doing this? I tried doing this, but it did not work (Integration tests were not added). I then tried adding the `pre-integration-test` phase as one of the goals of the failsafe-plugin, however it complained that the `pre-integration-test` is not an allowed goal. Only `integration-test` and `verify` are allowed. Cheers, - Ole - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Separating Integration and Unit Tests
Hi Barrie, Good tip - I'll keep it in mind. Thanks, - Ole On 01/01/2015 09:54 PM, Barrie Treloar wrote: And put your integration tests in another module, that way it can depend upon the completed results of what you want to integrate and you wont have to muck around with separating your unit tests from it (since you will *only* have integration tests in this module) On 2 January 2015 at 13:55, Benson Margulies bimargul...@gmail.com wrote: I think that what you actually want is two executions of surefire (or one of surefire and one of failsafe) with different test name patterns. On Thu, Jan 1, 2015 at 2:40 PM, Ole Ersoy ole.er...@gmail.com wrote: Hi, I'm attempting to separate my integration and unit tests using profiles and the maven build helper plugin. I have unit tests in the standard directory and integration tests in `src/integration-test/java`. When I run the default profile, I expect integration tests to be skipped and unit tests to be executed. When I run the `integration-test` profile with `mvn clean test -Pintegration-test` I expect the integration tests to be run and the unit tests to be skipped. Right now Maven is just ignoring the profile test settings: `skip.integration.tests` `skip.unit.tests` and it just runs all the tests regardless of which profile is active. My POM looks like this: project xmlns=http://maven.apache.org/POM/4.0.0; xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; modelVersion4.0.0/modelVersion groupIdcom.example.maven/groupId artifactIdseparating-integration-and-unit-test-execution/artifactId version1.0.0/version profiles profile idunit-test/id activation activeByDefaulttrue/activeByDefault /activation properties skip.integration.teststrue/skip.integration.tests skip.unit.testsfalse/skip.unit.tests /properties /profile profile idintegration-test/id properties skip.integration.testsfalse/skip.integration.tests skip.unit.teststrue/skip.unit.tests /properties /profile /profiles build plugins plugin groupIdorg.codehaus.mojo/groupId artifactIdbuild-helper-maven-plugin/artifactId version1.9.1/version executions !-- Add the integration-test source directory -- execution idadd-integration-test-sources/id phasegenerate-test-sources/phase goals goaladd-test-source/goal /goals configuration sources sourcesrc/integration-test/java/source /sources /configuration /execution /executions /plugin /build /project Thoughts? TIA, - Ole - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Separating Integration and Unit Tests
You can even use your profile still with this way. You stick the module definition into the profile. It does mess with releases; either you enable it with the release (in which case the release may slow down), or you leave it disabled which means that the version number doesn't get automatically bumped (just fix it up manually). On 2 January 2015 at 14:44, Ole Ersoy ole.er...@gmail.com wrote: Hi Barrie, Good tip - I'll keep it in mind. Thanks, - Ole On 01/01/2015 09:54 PM, Barrie Treloar wrote: And put your integration tests in another module, that way it can depend upon the completed results of what you want to integrate and you wont have to muck around with separating your unit tests from it (since you will *only* have integration tests in this module)