changeset 45:dc39eb43dfda

7902335: Simplified running of jcov tests Reviewed-by: lkuskov Contributed-by: jan.lahoda@oracle.com
author jjg
date Thu, 11 Oct 2018 10:37:27 -0700
parents 3d6e43ef0636
children 27376699db35
files build/build.properties build/build.xml
diffstat 2 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/build/build.properties	Thu Oct 11 10:37:15 2018 -0700
+++ b/build/build.properties	Thu Oct 11 10:37:27 2018 -0700
@@ -34,7 +34,12 @@
 # path to javatest library (empty value allowed if you do not need jtobserver.jar)
 javatestjar = javatest.jar
 
+# path to TestNG library
+testngjar = testng.jar
+
 # path to output directory
 result.dir =../JCOV_BUILD
 # path to jcov sources
 src.dir = ../src/classes
+# path to jcov test sources
+test.src.dir = ../test/unit
--- a/build/build.xml	Thu Oct 11 10:37:15 2018 -0700
+++ b/build/build.xml	Thu Oct 11 10:37:27 2018 -0700
@@ -299,4 +299,20 @@
             description="Creates the build-distribution.">
     </target>
 
+    <target name="test" depends="build-jcov">
+        <mkdir dir="${result.dir}/test/classes" />
+        <javac includeantruntime="false" encoding="iso-8859-1" debug="true" target="1.8" source="1.8"
+               srcdir="${test.src.dir}"
+               sourcepath="${test.src.dir}"
+               classpath="${testngjar}:${build.dir}/jcov.jar"
+               destdir="${result.dir}/test/classes">
+        </javac>
+        <taskdef classname="org.testng.TestNGAntTask" classpath="${testngjar}" name="testng"/>
+        <testng failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" outputdir="${result.dir}/test/result" suitename="jcov" testname="TestNG tests" workingDir="${result.dir}/test/work" verbose="2">
+                <classfileset dir="${result.dir}/test/classes" includes="**/*Test.class" />
+            <classpath>
+                <path path="${testngjar}:${build.dir}/jcov.jar:${result.dir}/test/classes"/>
+            </classpath>
+        </testng>
+    </target>
 </project>