Running a JUnit test after it was compiled in a different build


In my CD chain I need to do Java compile independent of running my JUnit tests. So I compile everything including the unit tests and everything goes into a series of JAR files. In a separate build I retrieve all the JAR files and now want to execute a set of tests matching a certain naming convention.

My naive attempt is listed below. In this case I have unzipped the JAR file containing the tests into a folder path called sandbox/classes. This runs but always comes back as UP-TO-DATE. Any help would be appreciated.

apply plugin: ‘java’

repositories {

dependencies {
testCompile group: ‘junit’, name: ‘junit’, version: ‘4.4’

ext.testClasspath = files(‘sandbox/classes’, file(‘sandbox/lib’).listFiles())

test {
scanForTestClasses true
include 'sandbox/classes/**/*SaTestSuite.class’
maxHeapSize = '2048m’
jvmArgs '-ea -server -XX:MaxPermSize=512m’
classpath = testClasspath

This looks suspicious, have you tried it without ‘sandbox/classes/’?