Canoo WebTest Community Site
[ start | index | login ]
start > How to convert results.xml to html

How to convert results.xml to html

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 ;)

2 comments (by webtester, sgoeschl) | post comment
labels
attachments
Created by Frank. Last edited by Frank, 2 years and 225 days ago. Viewed 2,707 times. #4
[diff] [history] [edit] [rdf]

Registration
Want to contribute? You can register here.

Help
For hints about formatting text see snipsnap-help.

Entry Points:

Editor's Pick:
Logged in Users: (0)
… and 2 Guests.

Recently Changed
snipsnap.org | Copyright 2000-2002 Matthias L. Jugel and Stephan J. Schmidt