Update, the main problem is caused by the extention it should be ‘.class’ not ‘.java’. Well I made this mistake because in Ant the code look like this:
<junit showoutput="yes" printsummary="yes" logfailedtests="yes" errorProperty="test.failed" failureProperty="test.failed">
<classpath>
<pathelement path="${build.dir}/src" />
<pathelement path="${target.bin}" />
<fileset dir="${basedir}/lib">
<include name="**/*.jar" />
</fileset>
</classpath>
<formatter type="xml" />
<!--launching neccessary tests -->
<batchtest fork="true" todir="${report.light.dir}">
<fileset dir="${build.dir}/src">
<include name="**/*Test.java" />
<exclude name="**/NotificationDaoImplTest.java" />
<exclude name="**/*MacroLoader*Test.java" />
<exclude name="**/*LaunchMyDSOPTest.java" />
<exclude name="**/*MTPDBDumpParserTest.java" />
<exclude name="**/*CorrespondenceParserForDELAMAISONTest.java" />
.....
so be careful when you move from Ant to Gradle. Finally the solution look simply like this:
task RunUnitTests(type:Test){
testClassesDir= sourceSets.unitTest.output.classesDir
classpath=sourceSets.unitTest.runtimeClasspath
forkEvery = 10
maxParallelForks = 4
include '**/*Test.class'
exclude '**/*otherTest.class'
test.testReportDir = file("$buildDir/reportsDirs")
test.testResultsDir = file("$buildDir/test-results")
}
Thank you again Peter!!