Thursday, February 25, 2010

Tip #8: How to save test results

There is a possibility to save JMeter test results to xml or csv file for further work (e.g. generating reports, importing to a database, etc.). It can be easy done by adding Simple Data Writer listener to a Thread Group and specifiing the filename. Of course you can specify the filename as JMeter variable or property.


You can choose the format of results file (xml or csv) and the fields to be saved clicking on Configure button and checking necessary options. As for me I prefer xml format and default options except Save URL which is useful when I need to know exact URLs of HTTP requests.

14 comments:

  1. Hi

    This article really good and i need some sample result reports to analyzing the performance reports for exact what i am asking approxmate test result.

    ReplyDelete
  2. Hi Victor,

    where we can find the saved files. After running scripts i am not finding any result files.

    ReplyDelete
    Replies
    1. You can find them in that directory you specified in Simple Data Writer settings.

      Delete
  3. Hi Victor,

    I am finding files but without any extention

    ReplyDelete
    Replies
    1. Did you specify the extension in the Simple Data Writer settings?

      Delete
  4. HiVictor,
    I have a use case like i need to take data from database and hit the server is it possible to talk database through jmeter ?

    ReplyDelete
    Replies
    1. Maybe, but you can do it also the other way - write a script that will get the data from a database to a CSV file and then will run JMeter with the CSV filename specified as command line parameter (property). Of course you should also add CSV data set config to your test plan.

      Delete
  5. Hi Victor, Very good blog.
    I have a query regarding the Simple Data Writer in Jmeter.
    Actually, I have a "Webservice(SOAP)Request Sampler inside my Test plan. I also have a "Simple Data Writer" as well inside the test plan to save Request and Responses to my local drive.
    I have entered "c:\ Prashanth\Result.xml" as the path where I have to store my results in the "FileName" field. When I run the test case, a text file gets generated in the designated patch as "Result.xml"

    Is it possible to change the file name to Threadgroupname_SamplerName_Results.xml during runtime

    I have renamed my Thread group to "Search" and the Sampler to "Currency Converter". Is it possbile to save the result in the following format
    Search_CurrencyConverter_Results.xml during runtime

    Thanks a lot in advance
    Regards
    Prashanth

    ReplyDelete
    Replies
    1. I think that is possible in more than one way. The first one that popped into my head is to use user defined variables. Just create two variables with values "Search" and "Currency Converter" (Test Plan settings in JMeter) and then you can use these variables almost anywhere, i.e. if the variable name is "var" and the variable value is "Search" you can specify the name of Thread Group as "${var}" and it will become "Search" during the runtime. The same is for results filename, i.e. "${var1}_${var2}_Results.xml".

      Delete
  6. Hello Victor,
    Thanks a lot for the reply. I tried following your instructions, but I was not successful in doing the same.
    As suggesed by you, I created a "Üser Defined Variables" under the thread group and added 2 user defined variables
    1) Name:TS; Value:Hotels
    2) Name: TC; Value:Search

    In the simple data writer step, I entered the File name as "c:\prashanth\${TS}_${TC}_Results.xml".
    But, teh results are not getting saved at all.
    Note: When I just gave an absoulte path(c:\prashanth), I was able to save the results.

    Could you please help me in this regard.

    I can send you the .jmx file to your e-mail id in case you want to take a look at the test plan.

    Regards
    Prashanth

    ReplyDelete
  7. Hi Victor,

    I want the DNS look up time and time to first byte..how will I get this?

    ReplyDelete
  8. Hi Victor,

    Thanks for the notes. what is the difference between simple data writer and aggregate Report?

    ReplyDelete
    Replies
    1. Simple Data Writer is used when you run jmeter in non-gui mode (i.e. -n command line argument) to prevent extra resources usage.

      Delete