skip to Main Content

i am having problem with extracting Timestamp from XML report, generated by JMeter using JS and i am using its values in XLS report.

i have tried multiple ways to extract Timestamp values in seconds only but it shows values as be year–month==day–hh–min–sec (epoch system) i just need to extract total time taken by the sampler to execute in seconds here is my sampler

<sample t="7" it="0" lt="0" ct="0" ts="1706503149549" s="true" lb=" Enterprise Dashboard - https://dr-wv.wmi360.com/Login/ACO/Dashboard" rc="200" rm="OK" tn="Smoke Thread Group 1-1" dt="text" by="1396210" sby="0" ng="1" na="1">
  <java.net.URL>https://dr-wv.wmi360.com/Login/ACO/Dashboard</java.net.URL>
</sample>

2

Answers


  1. Chosen as BEST ANSWER

    i want to share the solution the problem solved as i changed the XSL version to 2.0 and below is the code solution of conversion Unix epoch time of jmeter to human readable

    <td><xsl:value-of select='xs:dateTime("1970-01-01T00:00:00") + @ts * xs:dayTimeDuration("PT0.001S")'/></td>
    

  2. Timestamp is the moment in time when Sampler was started in milliseconds since Unix epoch. If you want to parse this value in JavaScript you can just create a new Date object from it:

    enter image description here

    If you’re looking for the response time (or elapsed time) – it’s t attribute value and in your case it’s 7 milliseconds. If you want to convert milliseconds to seconds – just divide it by 1000.

    In general according to JMeter Best Practices you should use CSV output, not XML one, maybe it worth considering switching, in this case JMeter will produce its results file in CSV mode which can be imported to MS Excel or equivalent without any extra effort.

    The relevant JMeter property which controls the behaviour is jmeter.save.saveservice.output_format , set it to csv and re-run your test. More information on JMeter Properties concept and ways of setting and overriding them: Apache JMeter Properties Customization Guide

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search