How to Print Variables in JMeter

I often find myself looking for this, though i very well know it. Its very useful to print variables in a Post Processor Bean shell in Jmeter, while you are developing / debugging your script. Specially when you are using variables that are picked up from CSV files. So here is a the 2 lines you use in a Beanshell to print the variables in Jmeter.

String auth = vars.get(“oauth_token”);
System.out.println(” AUTH Token = ” + auth);

 

Advertisements

2 Comments

Filed under JMeter

2 responses to “How to Print Variables in JMeter

  1. Paras

    String STR=vars.get(“qwerty”);
    vars.put(“paras”,STR);
    File file = new File(“D:\\TestImages\\images_to_upload\\paras.JPG”);

    I am not able to pass value of “paras” at the file path,how to do so.Though when printed ${paras} outside in the thread group, the value does get parsed

  2. erez

    temp = vars.get(“qwerty”);

    FileWriter fstream = new FileWriter(“C://tex.txt”,true);
    BufferedWriter out = new BufferedWriter(fstream);
    out.write(temp + “\n”);
    out.close();

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