Necessary steps to produce a html result view like
this one:
- Set the attributes "summary" and "saveresponse" in your config-task to true.
<webtest name="myTest">
<config
host="www.myserver.com"
port="8080"
protocol="http"
basepath="myApp"
summary="true"
saveresponse="true" />}
- Create a new macrodef(or target, whatever you like) in your build file, using the following code. It's actually taken from the file webtestsRunner.xml from the current webtest build. I only added the responseBrowser includes in the copy task.
<property name="webtest.config.resultpath" value="${basedir}/webtest-results"/>
<property name="webtest.config.resultfile" value="results.xml"/>
<property name="webtest.config.resultfile.html" value="${webtest.config.resultpath}/results.html"/><macrodef name="formatResults" description="formats the xml result file using the xslt">
<sequential>
<tstamp>
<format property="report.time" pattern="dd.MM.yyyy HH:mm" locale="de"/>
</tstamp>
<property name="resources.dir" value="${webtest.home}/resources"/>
<style
basedir="${webtest.config.resultpath}"
destdir="${webtest.config.resultpath}"
includes="${webtest.config.resultfile}"
force="true"
extension=".html"
style="${resources.dir}/WebTestReport.xsl">
<param name="reporttime" expression="${report.time}"/>
<param name="title" expression="${ant.project.name}"/>
</style>
<!-- copy resources needed by the html page to the same dir: the report must be ok too when opened from filesystem (without webserver) -->
<copy todir="${webtest.config.resultpath}">
<fileset dir="${resources.dir}">
<include name="report.css"/>
<include name="showHide.js"/>
<include name="images/*.*"/>
<include name="responseBr*.*"/>
</fileset>
</copy> <echo message="Webtest result overview available in ${webtest.config.resultfile.html}"/>
</sequential>
</macrodef>
- Now you can execute the target or call the macro after your test and it will create a nice formatted html view. Put attention to the 'result page' link; ctrl+click will open the responseBrowser which is a great way to go through your tests. I don't know why this feature is nowhere documented, so I had to write this ;)