[Webtest] Calculating Time to run Test

Denis N. Antonioli webtest@lists.canoo.com
Thu, 27 Apr 2006 09:23:51 +0200


Hi Cynthia

On 26 avr. 06, at 21:35, Cynthia A Reece wrote:

> I wanted to modify the reportFromSummary.xsl file to output the  
> time taken
> to complete a test.

The standard xsl for webtest displays the total time for the  
execution of a <webtest>.

> I had hoped to do this using the <xsl:call-template  
> name="date:difference">
> function but the date format of the starttime and endtime elements in
> testresult don't seem to be in a format I can easily parse.

The standard xsl does it by summing up the step/result/xxx/@duration  
of every
contained steps, which is a counted in seconds. xxx is either  
completed or failed.

This expression compute the duration of all the webtest from the report

     <xsl:variable name="duration.total"
                   select="sum(/summary/testresult/results/step/ 
result/node()[name()='completed' or name()='failed']/@duration)"/>

But it is easy to restrict to a single <webtest> by selecting its name:

     <xsl:variable name="duration.testA"
                   select="sum(/summary/testresult[@testspecname='A']/ 
results/step/result/node()[name()='completed' or name()='failed']/ 
@duration)"/>


There is also an xsl template to format the result in h:m:s
                 <xsl:call-template name="time">
                     <xsl:with-param name="msecs"  
select="$duration.total"/>
                 </xsl:call-template>

Have fun!

	dna

-- 
Binaries may die but source code lives forever.
   -- The Halloween Document