Tuesday, October 29, 2013

How to decode an encrypted (URL encrypted) value and placing into csv file

Step 1: Add thread Group to test plan
Step 2: Add Http Request as a child to  test paln

  Here, we are able to get SID value , which is encrypted. So in next request we need to pass this value (not encrypted value, need to pass decrypted value)

Step 3: Add Http Request and Pass the Decrypted SID value to this request

           Here add the small logic ${__urldecode(${SID})}

Step 4: Add the "Post processor" of " BeanShell PostProcessor" as a child to your Step 2 and paste the below code in script location.

vars.put("SID_J", "${__urldecode(${SID})}");
SID_J=vars.get("SID");

f = new FileOutputStream("C:\\OfficeWork\\Java\\id.txt"); //Windows

p = new PrintStream(f);
this.interpreter.setOut(p);
print(SID_J);
f.close();

Tuesday, October 8, 2013

Jmeter Variables/Correlated values to CSV file using Bean shell scripting in windows


1. Add thread group.
2. Add your "Http Sampler" with http request.
3. Use "Post processor" of "Regular expression Extractor" as a child to your "Step 2
        Here SessionID is the Dynamic value

4. Again Use "Post processor" of " BeanShell PostProcessor" as a child to your "Step 2



Write the below code to get Correlated values to CSV file.We have two Options while values sending to csv file:
1. Overwriting File for each Correlated value for each user
2. Appending Value for each time

1.Overwriting File for each Correlated value for each user:
SID_J=vars.get("SID");

f = new FileOutputStream("C:\\OfficeWork\\Java\\id.txt"); //Windows

p = new PrintStream(f);
this.interpreter.setOut(p);
print(SID_J);
f.close();

2.Appending Value for each time :
SID_J=vars.get("SID");
// Pass true if you want to append to existing file
// If you want to overwrite, then don't pass the second argument
f = new FileOutputStream("C:\\OfficeWork\\Java\\id.txt",true); //Windows
p = new PrintStream(f);
this.interpreter.setOut(p);
print(SID_J);
f.close();

Jmeter Variables/Correlated values to CSV file using Bean shell scripting in MAC, Linux and Unix

Step 1. Add thread group
Step 2. Add your "Http Sampler" with http request
Step 3. Use "Post processor" of "Regular expression Extractor" as a child to your "Step 2
        Here SID is the Dynamic value
Step 4. Again Use "Post processor" of " BeanShell PostProcessor" as a child to your "Step 2

Write the below code to get Correlated values to CSV file.


We have two Options :
1. Overwriting File for each Correlated value for each user
2. Appending Value for each time

Overwriting File for each Correlated value for each user:
-------------------------------------------------------------------------

SID_J=vars.get("SID");
f = new FileOutputStream("/Users/mcheepati/jmeter/results.csv");
p = new PrintStream(f);
this.interpreter.setOut(p);
print(SID_J);
f.close();

Appending Value for each time :
------------------------------------------------------

SID_J=vars.get("SID");
// Pass true if you want to append to existing file
// If you want to overwrite, then don't pass the second argument
f = new FileOutputStream("/Users/mcheepati/jmeter/results.csv",true);
p = new PrintStream(f);
this.interpreter.setOut(p);
print(SID_J);
f.close();