Home > jmeter > JMeter: Simple Data Writer + Current Date

JMeter: Simple Data Writer + Current Date

My first time to use Simple Data Writer, I have no idea how it works. So I figured it’s time to learn a new JMeter report (wink)

1. Add Simple Data Writer listener to my Google search script

2. Define its filename(where the generated result file will be saved) to:

D:\QA-Training\jakarta-jmeter-2.3.4\bin\reports\google.log.txt

3. Under “Log/Display” tick “Successes”

4. Run the test

I then opened google.log.txt in Open Office which is a comma delimited file and got this data:

simple data writer report

Looks helpful right? Except for the timeStamp which I can’t decipher the format… yet 🙂

Anyway, rerunning my test scripts updates the log file and appends the new results at the end of the file. But what if you’d like to parameterized your report and include the current time in your log file everytime you execute your test?

JMeter can absolutely do this… since it supports certain Functions and Variables

One of which is the __time function which returns the current time in various formats:

  • YMD = yyyyMMdd
  • HMS = HHmmss
  • YMDHMS = yyyyMMdd-HHmmss
  • USER1 = whatever is in the Jmeter property time.USER1
  • USER2 = whatever is in the Jmeter property time.USER2

From my current simple data writer listener, I edited its filename to:

D:\QA-Training\jakarta-jmeter-2.3.4\bin\reports\google.log.${__time(YMDHMS)}.txt

With this configuration, Jmeter generates a new log file with the current date and time in yyyyMMdd-HHmmss format, everytime I run the test. With regards to the timeStamp details, I’m still on my way to find it.

Advertisements
  1. Hari Kishore
    March 10, 2010 at 3:52 pm

    Thanks for your wonderful article keep up the good work

  2. October 2, 2010 at 3:34 am

    Time stamp = the number of milliseconds since midnight, January 1, 1970 UTC

  3. March 31, 2011 at 5:01 pm

    Herve Billiet :

    Time stamp = the number of milliseconds since midnight, January 1, 1970 UTC

    Wow! Thanks Herve for sharing this info =D

  4. Alessandro
    September 13, 2012 at 2:55 am

    For Excel:
    =(((COLUMN_ID_HERE/60)/60)/24/1000)+DATE(1970;1;1)

  5. shanmugaprabhu
    January 4, 2013 at 6:49 pm

    The below property/variable is not working for me. I am unable to get the current date as a property/variable

    ${__time(YMD)}

    Kindly help me…………

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: