Andrew Pietsch wrote:
Hi there,

I've been slowly writing a plugin for GWT development and have some slightly complicated testing requirements which I'm hoping the new test function slated for 0.8 will support. My projects use both TestNG (my preferred framework) and JUnit (required for testing certain GWT aspects).

My plugin needs to be able to do the following.

1. Need be able to create two test tasks, one that uses TestNG and one that uses JUnit 2. Run TestNG tests live in the normal test location (src/test/java, src/test/resources)
3. Run JUnit tests live under src/gwt-test/java and src/gwt-test/resources
4. Run JUnit (forked) with both custom JVM and normal -D args (for the GWT bits)

JUnit equivalent example:
java -XstartOnFirstThread -Xmx256M -Dgwt.args="-out build/reports/gwt" -classpath <cp goes here> junit.textui.TestRunner the.class.UnderTest

Will this be possible?


Absolutely. You would have a couple of options as to how this is structured. You could add a source set for the junit tests:

source {
   // Adds the source set
   gwtTest {
        java.srcDir = 'src/gwt-test/java'
        resources.srcDir = 'src/gwt-test/resources'
        // you probably will need
        compileClasspath = ...
        runtimeClasspath = ...
   }
}

task gwtTest(type: Test) {
   testClassesDir = source.gwtTest.classesDir
   classpath = source.gwtTest.runtimeClasspath
   // plus the -X, -D options
}

check.dependsOn gwtTest

The things you get for free by using a source set:
- compileGwtTest and processGwtTestResources tasks
- the dependencies of the gwtTest task are auto-wired
- checkstyleGwtTest or codenarcGwtTest tasks, if you need them

The things you don't get for free, but which we might add later:
- the gwtTest test task.
- gwtTestCompile and gwtTestRuntime classpaths wired up to the main classes or any dependency configurations added
- gradle build won't automatically run the gwtTest task


Adam


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to