Date: 2005-02-13T03:55:00
   Editor: PeterThomas
   Wiki: Apache JMeter Wiki
   Page: LogAnalysis
   URL: http://wiki.apache.org/jakarta-jmeter/LogAnalysis

   no comment

Change Log:

------------------------------------------------------------------------------
@@ -56,4 +56,59 @@
 
 attachment:DummyWebsitePerformance.JPG
 
-----
+== XSL script to extract Jmeter logs ==
+(Peter Thomas) There are XSL scripts that I found that come along with the 
Jmeter distribution in the "extras" folder as "jmeter-results-report.xsl" and 
"jmeter-results-detail-report.xsl".  However the HTML rendered is very complex, 
doesn't work well in Firefox and is bit difficult to grab into Excel.
+
+Here's a simple script that just converts the Jmeter XML into an HTML table 
and does nothing else.  You can do a "select all" on the HTML, and paste into 
Excel and it works smoothly.
+
+The advantage of the XSL approach is the handling of the nested "sampleResult" 
elements if they are encountered.  In the script below they are ignored.  You 
can uncomment the XML comment that appears toward the end of the script and 
pick up the nested "sampleResult"s if you want but they really get in the way.  
The primary level "sampleResult" elements contain the sum of nested 
"sampleResult" times so this should be OK.
+
+{{{
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
+<xsl:output method="html" indent="yes" encoding="US-ASCII" 
doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" />
+
+<xsl:template match="/">
+  <html>   
+    <body>
+       <xsl:apply-templates/>
+    </body>
+  </html>
+</xsl:template>
+
+<xsl:template match="testResults">
+  <table border="1">
+    <tr>
+      <th>timeStamp</th>
+      <th>dataType</th>
+      <th>threadName</th>
+      <th>label</th>
+      <th>time</th>
+      <th>responseMessage</th>
+      <th>responseCode</th>
+      <th>success</th>
+    </tr>    
+    <xsl:apply-templates/>
+  </table>
+</xsl:template>
+
+
+<xsl:template match="sampleResult">            
+  <tr>
+    <td><xsl:value-of select="@timeStamp"/></td>
+    <td><xsl:value-of select="@dataType"/></td>
+    <td><xsl:value-of select="@threadName"/></td>
+    <td><xsl:value-of select="@label"/></td>
+    <td><xsl:value-of select="@time"/></td>
+    <td><xsl:value-of select="@responseMessage"/></td>
+    <td><xsl:value-of select="@responseCode"/></td>
+    <td><xsl:value-of select="@success"/></td>
+  </tr>
+  <!--<xsl:apply-templates/>-->
+</xsl:template>
+    
+</xsl:stylesheet>
+}}}
+
+It should be easy to apply this XSL stylesheet on your Jmeter file.  I use a 
small Java program.  I think you can add an  xsl stylesheet processing 
instruction at the start of your XML file and open it in IE or Firefox 
directly.  Someone can post on how to exactly do this.
+
+Once within Excel, pivot tables are the way to go.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to