Please help me,
I want to automate testing my students’ turnins. Therefore I copy a build.gradle file into each turnin directory and run a build. Since I have a set of compiled JUnit tests in another project, I added the directory with the .class files to the testRuntime classpath. Unfortunately the test task ignores the classes and executes 0 tests. What’s my mistake?
//This build file will be used on each turnin
apply plugin: 'java'
apply plugin: 'eclipse'
repositories {
mavenCentral()
}
dependencies {
testCompile 'junit:junit:4.10'
testCompile 'org.hamcrest:hamcrest-all:1.1'
testRuntime files('../../turnin-tests/build/classes/test')
}
sourceSets {
main {
java {
srcDir '.'
}
}
}
test.doFirst {
println "${project.sourceSets.test.runtimeClasspath.files.join('\n')}"
}
mak:00864359 klaus$ pwd
/Users/klaus/Documents/dritte/hm/2011-se1/turnin-explode/00864359
mak:00864359 klaus$ ll
total 48
drwxr-xr-x@
7 klaus
staff
238 30 Nov 08:39 .
drwxr-xr-x
35 klaus
staff
1190 30 Nov 08:20 ..
-rw-r--r--
1 klaus
staff
4951 30 Nov 06:57 ICEControlCenter.java
-rw-r--r--
1 klaus
staff
931 30 Nov 06:21 SlidingWindow.java
-rw-r--r--
1 klaus
staff
1465 30 Nov 06:49 Wagon.java
-rw-r--r--
1 klaus
staff
1721 30 Nov 06:21 Worm.java
-rw-r--r--
1 klaus
staff
425 30 Nov 08:28 build.gradle
mak:00864359 klaus$ ll ../../turnin-tests/build/classes/test
total 56
drwxr-xr-x
8 klaus
staff
272 30 Nov 08:10 .
drwxr-xr-x
4 klaus
staff
136 30 Nov 08:10 ..
-rw-r--r--
1 klaus
staff
5891 30 Nov 08:10 ICEControllerCenterTestBasic.class
-rw-r--r--
1 klaus
staff
2194 30 Nov 08:10 ICEControllerCenterTestFreeTracks.class
-rw-r--r--
1 klaus
staff
1785 30 Nov 08:10 ICEControllerCenterTestShorten.class
-rw-r--r--
1 klaus
staff
2916 30 Nov 08:10 SlidingWindowTest.class
-rw-r--r--
1 klaus
staff
2105 30 Nov 08:10 WagonTest.class
-rw-r--r--
1 klaus
staff
3861 30 Nov 08:10 WormTest.class
mak:00864359 klaus$ gradle test
:compileJava
:processResources UP-TO-DATE
:classes
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test
/Users/klaus/Documents/dritte/hm/2011-se1/turnin-explode/00864359/build/classes/test
/Users/klaus/Documents/dritte/hm/2011-se1/turnin-explode/00864359/build/resources/test
/Users/klaus/Documents/dritte/hm/2011-se1/turnin-explode/00864359/build/classes/main
/Users/klaus/Documents/dritte/hm/2011-se1/turnin-explode/00864359/build/resources/main
/Users/klaus/Documents/dritte/hm/2011-se1/turnin-tests/build/classes/test
/Users/klaus/.gradle/caches/artifacts-4/junit/junit/c12498cf18507aa6433a94eb7d3e77d5/jars/junit-4.10.jar
/Users/klaus/.gradle/caches/artifacts-4/org.hamcrest/hamcrest-all/c12498cf18507aa6433a94eb7d3e77d5/jars/hamcrest-all-1.1.jar
/Users/klaus/.gradle/caches/artifacts-4/org.hamcrest/hamcrest-core/c12498cf18507aa6433a94eb7d3e77d5/jars/hamcrest-core-1.1.jar
The directory build/test-results is empty, and the test report html file says 0 tests were executed. :-?