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();

Wednesday, August 28, 2013

What is Heap , Stack and Permgen in Java

Student std = new Student();
after executing the line above memory status will be like this.
  • Heap: stores "new Student()"
  • Stack: stores information about "std"
  • Perm Space: stores information about Student class

Monday, July 8, 2013

what is JVM? How it divided into parts?

Java virtual memory holds Objects.

Oracle SQL query output to a file using Jmeter


Oracle AWR report generation using Jmeter


1. Add  "Thread group " and then add the "JDBC Connection Configuration" from the "Config Element" as shown below



2. Provide the Data base connection configuration info

       Database URL: jdbc:oracle:thin:@DB_host_Name:port:Service_Name
                          Ex:  jdbc:oracle:thin:@192.168.200.90:1521:test_instance
       JDBC Driver class: oracle.jdbc.driver.OracleDriver
       User Name: username of schema
      Password :Password of schema


 3. Add "Simple controller" to the "Thread group" and rename as "Begin Snapshot"



4. Add "Constant timer" as child to the "Simple controller (Begin Snapshot). Please see below

Don't Change the "Delay time " , Keep default value as same (300ms)





5. Add "JDBC Request as child to the "Simple Controller" as shown  and rename as "Begin Snapshot"





6. Finally The tree view of Jmeter looks like below



7. In JDBC request (Begin Snapshot), add the shown code, below is the Query that has to be copied to SQL Query area shown in below screenshot

select dbms_workload_repository.create_snapshot from dual 




8. Perform Step 3 (Add "Simple controller" to the "Thread group" and rename as "End Snapshot")
9. Perform Step 4 and change the "Thread Delay" value according to your requirement, please see more details below




10. Performance Step 5 and rename as "End Snapshot"
11.  In JDBC request (End Snapshot), add the shown code, below is the Query that has to be copied to SQL Query area shown in below screenshot

select dbms_workload_repository.create_snapshot from dual


12.  Finally the tree structure look like this



Following steps are very import to generate "awr report"

13. Add "Simple controller" to the " Thread group" and rename as "Generate Awr Report"
14.Add "Constant timer" as child to "Generate Awr Report" simple contoller
    Note : Don't change the "Delay time " in the "Constant timer"

15. Add the "JDBC Request" Sampler (rename as Get_Database_ID) to the "Generate Awr Report" Controller and enter the query and variable value as shown below


 16. Add the "JDBC Request" Sampler (rename as Generate_awr_Report) to the "Generate Awr Report" Controller and enter the query and Results variable value as shown below



17. Add the "BSF sample" as a child to  the "Generate Awr Report" Controller and Select "Script Language as "Beanshell" and write the code in script area

Final tree view look like this




  Please download the JMX file here https://app.box.com/s/z0yz36krdbf58cc6ybo4 , just chage the "Data base details" in "JDBC Connection Configuration"  and run the script