Thursday, February 18, 2016

Code to print values(Correlated parameter) in Jmeter


Below mentioned is the code with which we can print values in jmeter,
We have to write this code in Bean shell.

********ER_ID_Corr is the correlated value which we need to print ************

Var1 = vars.get("ER_Id_corr");


f = new FileOutputStream("C:\\CT\\Variable\\result.csv", true);
p = new PrintStream(f);

p.println(Var1);

p.close();
//print(Var1);
f.close();

For more detail please refer to screenshot

Converting or compiling Jmeter result file (JTL) to HTML

Apache Ant is a Java library and command-line tool whose mission is to drive processes described in build files as targets and extension points dependent upon each other. The main known usage of Ant is the build of Java applications. Ant supplies a number of built-in tasks allowing to compile, assemble, test and run Java applications. 
Ant is very flexible to use .It converts the JTl to HTML format .

Below are the setting to use Apache ANT that converts JTl in to an HTML file :

1)    Ensure that the JAVA_HOME environment variable is set to the folder where your JDK is installed.
2)    Download the binaries from http://ant.apache.org
3)    Unzip the zip file to a convenient location c:\folder. using Winzip, winRAR, 7-zip or similar tools.
4)    Create a new environment variable called ANT_HOME that points to the Ant installation folder, in this case c:\apache-ant-1.8.2-binfolder.
5)    Append the path to the Apache Ant batch file to the PATH environment variable. In our case this would be the c:\apache-ant-1.8.2-bin\binfolder. (%ANT_HOME%\bin)
6)    Now to check environmental Variable is set on cmd check Java –version and ant –version.
7)    On  cmd browse to extras in jmeter (cd D:\Software\apache-jmeter-2.13\extras) and set heap size .

8)    Then type > ant on command line and press enter
9)    In continuation without closing the java program press Ctrl+C and terminate batch job .
10)    Then enter in cmd line > ant –Dtest =<Filename> report  then press enter.
11)    It will create the same name html file



In the Resultant HTML file following information are provided :
1)    Total no. of success rate ,failures rate and the response time.







2)    Response time of each and every transaction.
3)    Highlighted failure count.

4)    Failure detail corresponding to the transaction.