Hi
We are moving from ant build script to gradle. Everything looked good until we came to running our jUnit integration tests. In nightly run it takes about 2 hours (via ant), but running same tests with gradle takes about 5 hours. This is very strange. From brief investigation I have found that there is some correlation with the number of methods within test class. The bigger is the number the slower is test. Now I am running a single test class with 28 test methods. Running either from ant or from eclipse or from intellij idea takes 1 minute, while running same test from gradle takes 3 minute and 30 seconds. I tried using both 1.8 and 1.9 gradle.
The test task:
task testSingle(type: Test) {
classpath = configurations.coreTest
maxHeapSize = ‘1G’
jvmArgs ‘-XX:MaxPermSize=192M’
include ‘com/test/core/CAllocateGainTest*’
}
Please see screen shots
- Running test with gradle
Memory usage
- Gradle process
- Forked gradle worker with jUnit test
- Running same test in eclipse
Eclipse settings
UPDATE
When I use ant’s junit task with similar configuration (see snippet below) test runs just fine:
task testAllocateGains() {
ant.junit(fork: ‘yes’, maxmemory: ‘1G’) {
formatter(type: ‘xml’)
classpath(path: configurations.coreTest.asPath)
jvmarg(value: ‘-XX:MaxPermSize=129M’)
batchtest(todir: ‘build/test-results’) {
fileset(dir: ‘build/classes/test’) {
include (name: ‘com/test/core/CAllocateGainTest*’)
}
}
}
}
Console output:
$ gradle testAllocateGains
:testAllocateGains UP-TO-DATE
BUILD SUCCESSFUL
Total time: 1 mins 15.575 secs
Memory usage
- Gradle process
- Forked ant jUnit process
Does anyone have any idea on how can I profile this issue?