Grails Maven Plugin

Add ability to test unit tests and integrations tests separately with maven

Details

  • Type: Sub-task Sub-task
  • Status: Reopened Reopened
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

Using only grails it's possible to run only unit test, but how do I do this with maven?
Is it possible to set some arg for mvn grails:test-app to it execute only unit tests or only integration tests instead of executing both always?

I couldn't find a way to test only the unit tests. It should be possible to do something like this:

mvn grails:test-app -DtestType=unit

Activity

Hide
Peter Ledbrook added a comment -

You can run

mvn grails:exec -Dcommand=test-app -Dargs="-unit"
Show
Peter Ledbrook added a comment - You can run
mvn grails:exec -Dcommand=test-app -Dargs="-unit"
Hide
Felipe Cypriano added a comment -

Thanks Peter,

This is enough for what I need.

Show
Felipe Cypriano added a comment - Thanks Peter, This is enough for what I need.
Hide
Peter Ledbrook added a comment -

I only consider the "grails:exec" option a workaround. I think the test-app goal (and probably mvn test too) should accept similar options to the standard Grails command.

Show
Peter Ledbrook added a comment - I only consider the "grails:exec" option a workaround. I think the test-app goal (and probably mvn test too) should accept similar options to the standard Grails command.
Hide
Felipe Cypriano added a comment -

Yeah, you're right. The "grails:exec" does not get the maven dependencies and don't work as expected.

Show
Felipe Cypriano added a comment - Yeah, you're right. The "grails:exec" does not get the maven dependencies and don't work as expected.
Hide
Felipe Cypriano added a comment -

It's also important be able to choose which class will run.

BTW, the fix version of this issue is 1.1, this isn't true since 1.1 is already released and this issue isn't fixed.

Show
Felipe Cypriano added a comment - It's also important be able to choose which class will run. BTW, the fix version of this issue is 1.1, this isn't true since 1.1 is already released and this issue isn't fixed.
Hide
Felipe Cypriano added a comment -

What about using the default lifecycle? For instance:

mvn test (run only the unit tests)
mvn integration-test (run only the integration tests)

And both should accept one class to test.

Show
Felipe Cypriano added a comment - What about using the default lifecycle? For instance:
mvn test (run only the unit tests)
mvn integration-test (run only the integration tests)
And both should accept one class to test.
Hide
Peter Ledbrook added a comment -

mvn integration-test should run the functional tests. I think the Grails integration tests should probably run in the test phase as they do now.

Show
Peter Ledbrook added a comment - mvn integration-test should run the functional tests. I think the Grails integration tests should probably run in the test phase as they do now.
Hide
Felipe Cypriano added a comment -

Any special reason?

Make mvn integration-test run functional test will confuse people, since it do a mess the with the test names.

Just to add the functional test we could use the plugin and do this:
mvn grails:functional-test

Show
Felipe Cypriano added a comment - Any special reason? Make mvn integration-test run functional test will confuse people, since it do a mess the with the test names. Just to add the functional test we could use the plugin and do this: mvn grails:functional-test
Hide
Peter Ledbrook added a comment -

The reason being that Grails functional tests match Maven's concept of integration tests much better than the Grails integration tests do. In my opinion anyway. The name "integration test" in Grails has often caused confusion in this area, although it can be argued that the name is technically correct.

Show
Peter Ledbrook added a comment - The reason being that Grails functional tests match Maven's concept of integration tests much better than the Grails integration tests do. In my opinion anyway. The name "integration test" in Grails has often caused confusion in this area, although it can be argued that the name is technically correct.
Hide
Jason Yankus added a comment -

This issue is a problem because of GRAILS-5711 (The test-app target fails when running integration tests with Hibernate plug-in de-installed) and GRAILS-5896 (Make Grails 1.2.1 Maven Integration archetype available)

My preference is for GRAILS-5896. Please upgrade the grails-maven-plugin to use the Grails 1.2.2 for the project archetype.

Show
Jason Yankus added a comment - This issue is a problem because of GRAILS-5711 (The test-app target fails when running integration tests with Hibernate plug-in de-installed) and GRAILS-5896 (Make Grails 1.2.1 Maven Integration archetype available) My preference is for GRAILS-5896. Please upgrade the grails-maven-plugin to use the Grails 1.2.2 for the project archetype.

People

Vote (3)
Watch (4)

Dates

  • Created:
    Updated: