I'm setting up Randoop test case generation to run across my projects. I've achieved this with a Gradle task of type JavaExec:
task RandoopGenerateL1Tests(dependsOn: ['assembleDebug']) {
group = "Verification"
description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
//Various setup things here...
doLast {
javaexec {
classpath = tasks['testDebugUnitTest'].classpath
classpath = classpath + files('D:\\randoop-3.1.5\\randoop-all-3.1.5.jar')
systemProperty 'RANDOOP_PATH', 'D:\\randoop-3.1.5'
systemProperty 'RANDOOP_JAR', 'D:\\randoop-3.1.5\\randoop-all-3.1.5.jar'
def classlistarg = '--classlist=' + classlistfilepath
def packagenamearg = '--junit-package-name=' + key
def junitoutputdirarg = '--junit-output-dir=' + projectDir.path + '/src/randooptest/java'
def timelimitarg = '--timeLimit=10'
main = 'randoop.main.Main'
args 'gentests',classlistarg,packagenamearg,junitoutputdirarg,timelimitarg
println "Randoop will be invoked with args: " + args.toString()
}
}
}
The --timeLimit=10 argument is meant to apply a time limit (in seconds) to the exploration stage of Randoop, but this is only working sporadically for me. In some executions of this task, Randoop begins the exploration stage and then "freezes" - the java.exe process consumes 0% CPU and no output occurs.
Is it possible to put a time limit on the JavaExec task to apply a time limit on this task?
Thanks!