Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make it possible to get HTML output from JUnit tests too

  • Loading branch information...
commit 6847575582d66d1002c4b187ff7f84f35d7efede 1 parent 91c2587
@olabini authored
View
14 build.xml
@@ -23,6 +23,8 @@
<mkdir dir="${build.dir}"/>
<mkdir dir="${coverage.dir}"/>
<mkdir dir="${classes.dir}"/>
+ <mkdir dir="${test.results.dir}"/>
+ <mkdir dir="${html.test.results.dir}"/>
</target>
<target name="generate_filters" depends="prepare" description="Generates source files">
@@ -68,13 +70,23 @@
</target>
<target name="ci-test" depends="compile" description="Runs all ISpec tests">
- <java classname="ioke.lang.Main" fork="true" failonerror="true" maxmemory="256m">
+ <java classname="ioke.lang.Main" fork="true" maxmemory="256m" resultproperty="ispec.result">
<sysproperty key="ispec.ansi" value="${ispec.ansi}"/>
<classpath refid="build.classpath"/>
<classpath path="${classes.dir}"/>
<arg line="bin/ispec test -fx to: ${test.results.dir}"/>
</java>
+ <junitreport todir="${test.results.dir}">
+ <fileset dir="${test.results.dir}" includes="TEST-*.xml"/>
+ <report format="frames" todir="${html.test.results.dir}"/>
+ </junitreport>
+ <condition property="ispec.failure">
+ <not>
+ <equals arg1="0" arg2="${ispec.result}"/>
+ </not>
+ </condition>
+ <fail if="ispec.failure" message="Test(s) failed."/>
</target>
<target name="coverage" depends="coverage.instrument" description="Runs all ISpec tests using Cobertura and produces a report">
View
2  default.build.properties
@@ -9,5 +9,7 @@ coverage.classes.dir=${coverage.dir}/classes
coverage.report.dir=${coverage.dir}/report
classes.dir=${build.dir}/classes
test.results.dir=${build.dir}/test-results
+html.test.results.dir=${test.results.dir}/html
+html.test.coverage.results.dir=${test.results.dir}/html-coverage
javac.version=1.5
release.dir=rels
View
16 lib/ioke/ispec/formatter.ik
@@ -326,7 +326,7 @@ ISpec do(
outf println(" <error message=\"#{makeTextXmlSafe(res[2][1] condition text)}\" type=\"#{res[2][1] condition kind}\">#{makeTextXmlSafe(res[2][1] condition text)}\n\n#{res[2][1] condition example stackTraceAsText(res[2][1] condition)}")
outf println(" </error>")
)
- outf println(" </testcase\">")
+ outf println(" </testcase>")
)
)
@@ -336,9 +336,19 @@ ISpec do(
))
)
)
-
+
makeTextXmlSafe = method(text,
- text replaceAll("&", "&amp;") replaceAll("<", "&lt;") replaceAll(">", "&gt;"))
+ text chars map(in,
+ case(in,
+ "&", "&amp;",
+ "<", "&lt;",
+ ">", "&gt;",
+ "\"", "&#34;",
+ else, if(in[0] > 255,
+ "&##{in[0]};",
+ in)
+ )) join
+ )
formatDuration = method(val,
after = val%1000
Please sign in to comment.
Something went wrong with that request. Please try again.