diff options
author | Leif Åstrand <leif@vaadin.com> | 2011-10-19 13:57:32 +0000 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2011-10-19 13:57:32 +0000 |
commit | a1b2f28eece282166e197ccf115cc2e2c444454a (patch) | |
tree | e207d64fe7271b1b5a3a6bd626fe13cf5b4bce2e /build | |
parent | 803fcb1d6e7c7c914e4dc70cdd9d1f96ef587b6c (diff) | |
download | vaadin-framework-a1b2f28eece282166e197ccf115cc2e2c444454a.tar.gz vaadin-framework-a1b2f28eece282166e197ccf115cc2e2c444454a.zip |
#7810 Server side test coverage reporting
svn changeset:21753/svn branch:6.7
Diffstat (limited to 'build')
-rw-r--r-- | build/build.xml | 100 |
1 files changed, 99 insertions, 1 deletions
diff --git a/build/build.xml b/build/build.xml index 0b2481ae81..acb9d83f8a 100644 --- a/build/build.xml +++ b/build/build.xml @@ -21,6 +21,13 @@ <!-- Locations of Ant task JARs - build properties not yet read at this point --> <property name="ant.task.jar.antcontrib" value="build/lib/ant-contrib-1.0b3.jar" /> <property name="ant.task.jar.maven" value="build/lib/maven-ant-tasks-2.0.10.jar" /> + + <path id="emma.lib" > + <pathelement location="build/lib/emma_ant.jar" /> + <pathelement location="build/lib/emma-2.0.5312-patched.jar" /> + </path> + + <taskdef resource="emma_ant.properties" classpathref="emma.lib" /> <!-- ant contrib required for flow control (for loop, if, property override) --> <!-- Note that we have to use a namespace to avoid clash when running sub-ant. --> @@ -110,6 +117,11 @@ <!-- Create result dir unless already exists --> <mkdir dir="${result-path}" /> + <!-- Create dirs that might be used by the test coverage generation --> + <mkdir dir="${result-path}/war_emma_classes" /> + <mkdir dir="${result-path}/junit_emma_classes" /> + <mkdir dir="${result-path}/coverage" /> + <echo>We are using gwt version ${gwt-version}.</echo> <!-- Destination files --> @@ -363,6 +375,9 @@ <fileset dir="lib/core"> <include name="jetty/**/*" /> </fileset> + <fileset dir="build/lib"> + <include name="emma-2.0.5312-patched.jar" /> + </fileset> </copy> <!-- Add WebContent --> @@ -565,8 +580,25 @@ <mkdir dir="${output-dir}/META-INF"/> <echo file="${output-dir}/META-INF/VERSION">${version.full}</echo> <echo file="${output-dir}/META-INF/GWT-VERSION">${gwt-version}</echo> + + <emma enabled="${emma.enabled}" > + <instr instrpath="${result-path}/classes" + destdir="${result-path}/war_emma_classes" + mode="copy" + metadatafile="${result-path}/war.es" + merge="false" + > + <filter includes="com.vaadin.*" /> + <filter excludes="com.vaadin.terminal.gwt.*" /> + <filter excludes="com.vaadin.tests.*" /> + <filter excludes="*Test*" /> + <filter excludes="com.vaadin.launcher.*" /> + <filter excludes="com.vaadin.data.util.sqlcontainer.*" /> + </instr> + </emma> + <jar jarfile="${output-dir}/WebContent/WEB-INF/lib/${lib-jar-name}" - compress="true" manifest="build/package/META-INF/MANIFEST.MF"> + compress="true" manifest="build/package/META-INF/MANIFEST.MF" duplicate="preserve"> <metainf dir="${output-dir}/META-INF"/> <manifest> <attribute name="Vaadin-Package-Version" value="1" /> @@ -578,6 +610,13 @@ <attribute name="GWT-Version-Dependencies" value="${gwt-version-dependencies}" /> <attribute name="Bundle-Version" value="${version.full}" /> </manifest> + <!-- Include any instrumented class files before the normal classes --> + <fileset dir="${result-path}/war_emma_classes"> + <patternset> + <exclude name="${toolkit-package}/tests/**"/> + <exclude name="${toolkit-package}/launcher/**" /> + </patternset> + </fileset> <fileset dir="${result-path}/classes"> <patternset> <exclude name="${toolkit-package}/tests/**"/> @@ -891,21 +930,68 @@ <antcall inheritrefs="true" inheritall="true" target="testbench-tests"></antcall> <antcall inheritrefs="true" inheritall="true" target="server-side-tests"></antcall> </parallel> + + <!-- Create a combined report from each test's sub report --> + <emma enabled="${emma.enabled}" > + <merge file="${result-path}/combined.es"> + <fileset dir="${result-path}" > + <include name="*.ec" /> + <include name="*.em" /> + </fileset> + </merge> + <report sourcepath="${result-path}/src/core" > + <fileset dir="${result-path}" > + <include name="combined.es" /> + </fileset> + + <txt outfile="../${result-path}/coverage/coverage-combined/coverage.txt" /> + <html outfile="../${result-path}/coverage/coverage-combined/coverage.html" /> + </report> + </emma> + <echo>##teamcity[publishArtifacts '${result-path}/coverage']</echo> </target> <!-- Assumes java classes have been compiled but depends does not work out well as this is run from a <parallel> task--> <target name="server-side-tests" unless="tests.serverside.skip"> + <emma enabled="${emma.enabled}" > + <instr instrpath="${result-path}/classes" + mode="copy" + destdir="${result-path}/junit_emma_classes" + metadatafile="${result-path}/unittests.em" + merge="false" + > + <filter includes="com.vaadin.*" /> + <filter excludes="com.vaadin.tests.*" /> + <filter excludes="com.vaadin.terminal.gwt.*" /> + <filter excludes="*Test*" /> + <filter excludes="com.vaadin.launcher.*" /> + </instr> + </emma> <junit printsummary="yes"> <classpath> + <pathelement path="${result-path}/junit_emma_classes" /> <pathelement path="${result-path}/classes" /> + <path refid="emma.lib" /> <path refid="compile.classpath"/> </classpath> + <jvmarg value="-Demma.coverage.out.file=../${result-path}/unittests.ec" /> <batchtest fork="yes"> <fileset dir="tests/server-side" includes="**/*.java" excludes="**/Abstract*.java" /> <fileset dir="tests/client-side" includes="**/*.java" excludes="**/Abstract*.java" /> </batchtest> </junit> + <emma enabled="${emma.enabled}" > + <report sourcepath="${result-path}/src/core" > + <fileset dir="${result-path}" > + <include name="unittests.*" /> + </fileset> + + <txt outfile="../${result-path}/coverage/coverage-unittests/unittests_coverage.txt" /> + <html outfile="../${result-path}/coverage/coverage-unittests/unittests_coverage.html" /> + </report> + </emma> + <echo>##teamcity[publishArtifacts '${result-path}/coverage']</echo> </target> <!-- Assumes java classes have been compiled but depends does not work out well as this is run from a <parallel> task--> @@ -946,6 +1032,18 @@ <property name="com.vaadin.testbench.debug" value="${com.vaadin.testbench.debug}"/> <property name="com.vaadin.testbench.screenshot.block.error" value="${com.vaadin.testbench.screenshot.block.error}"/> </ant> + + <emma enabled="${emma.enabled}" > + <report sourcepath="${result-path}/src/core" > + <fileset dir="${result-path}" > + <include name="war.*" /> + </fileset> + + <txt outfile="../${result-path}/coverage/coverage-testbench/testbench_coverage.txt" /> + <html outfile="../${result-path}/coverage/coverage-testbench/testbench_coverage.html" /> + </report> + </emma> + <echo>##teamcity[publishArtifacts '${result-path}/coverage/']</echo> </target> <!-- Assumes java classes have been compiled but depends does not work out well as this is run from a <parallel> task--> |