I want to create a groovy maven project and be able to execute groovy tests,
Geb test, spock tests, etc.

To start, I just want to execute tests that extend GroovyTestCase. I placed
tests in src/test/groovy, but they won't execute. Only the tests in
src/test/java will execute.

I created the project using the quickstart archetype, then configured the
pom from the gmaven 1.0 wiki.
<http://docs.codehaus.org/display/GMAVEN/GMaven+1.0+Release>

<project>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.codehaus.groovy.maven</groupId>
                <artifactId>gmaven-mojo</artifactId>
                <version>1.0</version>
            </dependency>
            <dependency>
                <groupId>org.codehaus.groovy.maven.runtime</groupId>
                <artifactId>gmaven-runtime-1.6</artifactId>
                <version>1.0</version>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.groovy.maven</groupId>
                    <artifactId>gmaven-plugin</artifactId>
                    <version>1.0</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>

I then added src/test/groovy and an example Test:

package com.mydomain.whatever;
import groovy.util.GroovyTestCase

class GroovyAppTest extends GroovyTestCase {
    void testSomething() {
        assert 1 == 1
        assert 2 + 2 == 4 : "We're in trouble, arithmetic is broken"
    }
}

when I run mvn test I get:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
There are no tests to run.

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 3 seconds
[INFO] Finished at: Mon Jan 17 08:09:29 MST 2011
[INFO] Final Memory: 16M/81M
[INFO]
------------------------------------------------------------------------

Reply via email to