Hi Kelcy,
Updating the xsl to add custom information into the generated reports is
actually pretty simple. The two problems with updating the file is your file
will not be kept in sync with the latest file from webtest and you need to
somehow distribute your customized xsl to all others running these tests.
We run our tests using the folder structure created by webtest's sample project
( > webtest -f path/to/webtest/home/webtest.xml wt.createProject ) and invoke
the tests using the build.xml created with modifications.
In the webtest project root directory, we created a resources folder and copied
WebTestReport.xsl from /path/to/webtest/home/resources. We modified the
build.xml to add the following line:
<!-- Define XSL Templates --> <property name="wt.htmlReports.xslt"
location="resources/WebTestReport.xsl"/>
We then altered our copied WebTestReport.xsl to create special output handling
for specific types of <testInfo> tags.
In WebTestReport.xsl, find the following block:
<!--
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
--> <!-- Special representation for the <testInfo .../> steps if any -->
<xsl:template name="displayTestInfo"> <xsl:if test=".//st...@taskname =
'testInfo']"> <div class="testInfo"> <div
class="testInfoTitle">Test info</div> <ul class="testInfo">
<xsl:for-each select=".//st...@taskname = 'testInfo']">
<li> <b>
<xsl:value-of select="paramet...@name = 'type']/@value"/>
<xsl:text>:&space;</xsl:text> </b>
<xsl:value-of select="concat(paramet...@name =
'info']/@value, paramet...@name = 'nested text']/@value)"/>
</li> </xsl:for-each> </ul>
</div> </xsl:if> </xsl:template>
Change it to the following and update as needed:
<!--
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
--> <!-- Special representation for the <testInfo .../> steps if any -->
<xsl:template name="displayTestInfo"> <xsl:if test=".//st...@taskname =
'testInfo']"> <div class="testInfo"> <div
class="testInfoTitle">Test info</div> <ul class="testInfo">
<xsl:for-each select=".//st...@taskname = 'testInfo']">
<xsl:choose> <xsl:when
test="paramet...@name = 'type' and @value='reportLink']"/>
<li> <b>
<xsl:value-of select="paramet...@name = 'type']/@value"/>
<xsl:text>:&space;</xsl:text>
</b>
<a>
<xsl:attribute name="href">
<xsl:value-of select="paramet...@name = 'info']/@value"/>
</xsl:attribute>
<xsl:text><xsl:value-of select="paramet...@name = 'nested
text']/@value"/></xsl:text> </a>
</li>
</xsl:when>
<xsl:otherwise> <li>
<b> <xsl:value-of
select="paramet...@name = 'type']/@value"/>
<xsl:text>:&space;</xsl:text> </b>
<xsl:value-of select="concat(paramet...@name =
'info']/@value, paramet...@name = 'nested text']/@value)"/>
</li> </xsl:otherwise>
</xsl:for-each> </ul> </div> </xsl:if>
</xsl:template>
Now, to add a link in your webtest, you would use the following line:
<testInfo type="reportLink" info="http://server:port/path/to/file">Text to use
for the anchor tag</testInfo>
Cheers,
John Spann | Associate Software Engineer
Citrix Online Division
Citrix Systems, Inc.
6500 Hollister Avenue
Goleta, CA 93117 USA
www.citrix.com
Phone: 805.690.3489
Cell: 805.729.0008
Email: [email protected]
________________________________
From: Kelcy Monday <[email protected]>
Reply-To: <[email protected]>, Kelcy Monday <[email protected]>
Date: Thu, 21 May 2009 07:03:12 -0700
To: <[email protected]>
Subject: Re: [Webtest] Inserting (and honoring) html into WebTest report
I do not see anything in this file which could control something like whether
or not html is honored in the report.
Kelcy Monday
x26321
Michael Habbert <[email protected]>
Sent by: [email protected] 05/05/2009 02:13 PM
Please respond to
[email protected]
To
[email protected]
cc
Subject
Re: [Webtest] Inserting (and honoring) html into WebTest report
Hi Kelcy,
the best way to adjust the html-report is to change the xsl-transformation.
you can do that by manipulation the WebtestReport.xsl-file
mfg
Michael Habbert
Kelcy Monday schrieb:
> I would like to know if there is any way to insert html into a report in
> such a way that it is honored as html and not just straight text. In
> particular, I am looking for a way to insert a link to another file such
> as:
>
> file:///path/to/file <file:///path/to/file> or
> http:/server:port/path/to/file
>
> I have tried using the ant task "echo" to send the text to the report.
> I've sent actual html code (<a href...) and just (file) browser protocol
> links such as the ones mentioned above. The webtest report doesn't seem
> to honor either.
>
> Is there another way to accomplish this?
>
> NOTE:
> I am using WebTest R_1758 on Ubuntu 9.04 with Firefox 3 browser to view
> reports.
>
> Thanks,
> Kelcy Monday
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest
<http://lists.canoo.com/mailman/listinfo/webtest>
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest