Is there something I need to do to custom test targets to get TeamCity to recognize them and get code coverage?
I have my build running in TeamCity 6.5 and until I added GWT Tests, all of the code coverage stuff was working great (using the Intellij IDEA coverage runner). When I added my first GWT test, I noticed that the coverage #s reported by TeamCity didn't improve at all. Unfortunately TeamCity is completely ignoring my GWT tests.
Since getting GWTTests to run in Gradle is still kind of uncharted territory, I published all of the details on how I did it here:
Note the "test.dependsOn(gwtTestCompile);" part. When I run "gradle test" it runs all of my GWT tests first, and then the other regular tests.
Are these tests reported by TeamCity at all? I mean, can you see them in build results?
After taking closer look at your setup, I have a few comments.
First of all, to get coverage data, you will need to replace the call to ant.junit with separate task, extending Test, e.g. task gwtTest(type: Test, dependsOn: gwtTestCompile)
More information on Test task can be found here. TeamCity will detect Test task and add jvm arguments to collect coverage data.
Also, I would replace direct call to ant.javac with properly configured Compile-type task. This way you will benefit from gradle incremental builds feature.
added some ideas on build script optimizations.