Andrew Pietsch wrote:
Excellent, sounds great.
There's a few other things with GWT too:
- It needs src/main/java and src/gwt-test/java directories to be included in the class path for testing

You'd do something like:

source {
   gwtTest {
       compileClasspath = source.main.classes + ....
   }
}


This adds in the classes from src/main/java to the compile classpath for the src/gwt-test/java classes.

The default runtime classpath for a source set is this.classes + this.compileClasspath. So, given the above, your test task would pick up the classes from src/gwt-test/java, src/main/java plus anything else you add to the compile classpath for the gwtTest source set.

The classpath management for source sets in 0.8 will be pretty basic. We'll see how it goes and make things easier in 0.9. For example, we might add some way to declare that the gwtTest source set contains tests, so that the main classes are automatically added to the gwtTest compile and runtime classpaths, and the gwtTest task is automatically added to run the tests.

- There are different testing modes (hosted, web and manual). In the manual case GWT prompts and waits for user interaction (via std out I believe) so that would need to be visible from gradles output. I'm currently still on 0.5.2 and have to run with -d to see anything.


I don't think we've improved anything for test output since 0.5. Could you add a JIRA issues for this?

Hopefully these are possible as well.

Cheers
Andrew

2009/9/24 Adam Murdoch <[email protected] <mailto:[email protected]>>



    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