Showing posts with label Jmeter. Show all posts
Showing posts with label Jmeter. Show all posts

Monday, 26 January 2015

Database Performance Testing Using Jmeter

Hi friends, this is my second post in Jmeter and in this post I'm gonna explain you how to test database using Jmeter and for that i will be using MySql database.

Step 1: Download MySql Java Connector 5.1.34 from the URL:http://mvnrepository.com/artifact/mysql/mysql-connector-java/5.1.34.

Step 2: Once download is complete then copy mysql-connector-java-5.1.34.jar into lib folder of Apache jmeter.


Step 3: Start Jmeter and right click on Test Plan and add Thread Group and give any value you want to give, I'm going to give value as 20.


Step 4 : Right click on Thread Group and add 'JDBC Connection Configuration' element and your element should look like this.


in the above image if you could see database URL:jdbc:mysql://localhost:3306:/forjmeter so here 3306 is port number of mysql and 'forjmeter' is the name of the database and make sure you have created 'forjmeter' database and also created table and inserted some values into table and you can change these things accordingly.

Step 5: Right click on Thread Group and add 'JDBC Request' and after adding write a query to fetch data from database as shown below and please make sure that Variable name is same in JDBC Request and JDBC Connection Configuration elements.


Step 6: Right click on Thread Group and add few listeners and I'm going to add three listeners.


Step 7: Now save the script and click on Start symbol to run the script.


So see 'View Result Tree' all are in green color it means it's a pass and also see 'Graph Results' in that Throughput is quite high so it means database is responding well.:)

Well, This is how you can test database performance using Jmeter and please write different scripts by changing elements to test your database.cheers


Sunday, 25 January 2015

Simple Jmeter Test Plan

Hi, this is my first post in jmeter hence like to start with preparing a simple jmeter test plan.

Now Consider a scenario where you asked to do performance testing of your website with 25 users.? the answer is to use Jmeter which is open source tool for doing performance testing and i hope you guys know how to install jmeter and how to start running simple test. assuming that you guys have basic knowledge in jmeter i will start showing how to write test script which will test website using 25 users, for that i will be using 'Rediff.com'.

Step 1: Once you open Jmeter you will see two things 1) test plan 2) Workbench now right click on Test Plan and add 'Thread Group'. Throup group is an element where you define number of users and your Thread Group should look like this.


Step 2: Right click on ThreadGroup and add 'HTTP request default', once done then in 'HTTP request default' add 'www.rediff.com' in 'Server name or IP' textbox.


Step 3: Again right click on ThreadGroup and add 'HTTP Request' and in Path mention the page name where you want to navigate.(See screenshot).


Step 4: You can add as many as HTTP Request you want and specify only path name in each HTTP request, in my case i have added one more HTTP request as shown below.


Step 5: Now add some listeners to view Test Execution report, I'm going to add three Listeners.


Step 6: Now Test script is ready to run but save it first by pressing 'Ctrl+s' on keyboard and it will pop up one window and give the appropriate name.



Step 7: Now you are ready to run your Test so click on 'Start' symbol and view the result by clicking on Listeners.



Step 8: If you see in 'View Results tree' listener all request marked in Green so it means it's a pass.:) and if any request is marked in Red then it's a fail.

Step 9: Now see the 'Graph results' you will see 'No of Samples' , 'Average', 'Deviation' and 'ThroughPut' and most important of these is 'Throughput'.
Throughput - Number of request processed by server in one minute and larger the Throughput the good is the performance of the server but in my case Throughput is very less but it is because of my slow Internet and Throughput depends on Internet speed too and if you run same test at your side then Throughput will be different.

Step 10: So this is how you can create simple Jmeter Script and now can add or remove elements based on your requirements.

I hope you are able to run the test plan..:)