{"id":18912,"date":"2015-04-23T20:43:19","date_gmt":"2015-04-23T15:13:19","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=18912"},"modified":"2015-04-23T20:43:19","modified_gmt":"2015-04-23T15:13:19","slug":"building-mysql-database-test-plan-using-jmeter","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/building-mysql-database-test-plan-using-jmeter\/","title":{"rendered":"Building MySql Database Test Plan Using Jmeter"},"content":{"rendered":"<p><span style=\"font-size: large\"><span style=\"color: #000000\">In this blog we will setup the jmeter and we will see how to create a simple test plan to test the database server.We will use MySql database server for our test purpose or you can use any-other database<\/span>.<\/span><\/p>\n<p><span style=\"font-size: large;color: #ff9900\">Setup requirement<\/span><\/p>\n<ul>\n<li>Download the latest jmeter\u00a0from <a href=\"http:\/\/jmeter.apache.org\/download_jmeter.cgi\">here<\/a> and untar jmeter in you home directory.<\/li>\n<li>Download\u00a0JDBC driver is needed in JMeter for connection with MySQL database. You can download MySQL JDBC driver from <a title=\"MySQL JDBC Drivers\" href=\"http:\/\/dev.mysql.com\/downloads\/connector\/j\/5.0.html\" target=\"_blank\">here<\/a>.<\/li>\n<li>Copy the driver JAR file in JMeter installation\u2019s lib folder. Restart JMeter if it is already open.<\/li>\n<li>Install the mysql on you machine.<\/li>\n<li>Once MYSQL is installed, follow the steps below to setup the database\n<ul>\n<li>Create a database with name &#8220;loadtesting&#8221;.<\/li>\n<li>Create a table loadtesting.<\/li>\n<li>Insert records into loadtesting<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>[js]<\/p>\n<p>mysql&gt; use loadtesting;<br \/>\nDatabase changed<\/p>\n<p>mysql&gt; INSERT INTO loadtesting<br \/>\n-&gt; (customer_id,order_id,result) VALUES<br \/>\n-&gt; (2,1,1);<br \/>\nQuery OK, 1 row affected (0.04 sec)<\/p>\n<p>mysql&gt; INSERT INTO loadtesting<br \/>\n-&gt; (customer_id,order_id,result) VALUES<br \/>\n-&gt; (1,1,1);<br \/>\nQuery OK, 1 row affected (0.04 sec)<\/p>\n<p>[\/js]<\/p>\n<p><span style=\"font-size: large;color: #ff9900\">Create Test Plan<\/span><\/p>\n<p><span style=\"font-size: large;color: #000000\">let&#8217;s start the JMeter from \/home\/prashants\/jmerter\/apache-jmeter-2.13\/bin\/jmeter.sh<\/span><\/p>\n<p><span style=\"font-size: large;color: #000000\">Add the following components in the Test plan<\/span><\/p>\n<ol>\n<li><span style=\"color: #333333\"><span style=\"color: #333333\"><strong>Thread group named &#8216;MySql Database&#8217; :\u00a0<\/strong><\/span><\/span>Select Add &gt; Threads (Users) &gt; Thread Group.<\/li>\n<li><span style=\"color: #333333\"><strong>Sampler of type JDBC Request :\u00a0<\/strong>Select Add &gt; Sampler &gt; JDBC Request\u00a0<\/span><\/li>\n<li>Add the following value in\u00a0<strong>JDBC Request:<\/strong>\n<ul>\n<li>Name : Query<\/li>\n<li>Enter the Pool Name : Test<\/li>\n<li>Query Type : Select statement<\/li>\n<li>Enter the SQL Query String field<\/li>\n<\/ul>\n<\/li>\n<li><strong>JDBC Request <\/strong>configuration can seen in screen shot<a href=\"\/blog\/wp-ttn-blog\/uploads\/2015\/04\/Select.png\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-19245 alignnone aligncenter\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/04\/Select.png\" alt=\"Select\" width=\"507\" height=\"374\" \/><\/a><\/li>\n<li><span style=\"color: #333333\"><strong>Config element of type JDBC Connection Configuration<\/strong> : Select Add &gt; Config Element &gt; JDBC Connection Configuration<\/span><\/li>\n<li>Add the following value in\u00a0<strong>JDBC Connection Configuration<\/strong><strong>:<\/strong>\n<ul>\n<li><span style=\"color: #333333\"><strong>Variable Name :<\/strong> Variable name bound to pool. This needs to identify the configuration uniquely. It is used by the JDBC Sampler to identify the configuration to be used. We have named it as test.<\/span><\/li>\n<li><span style=\"color: #333333\"><strong>Database URL:<\/strong> jdbc:mysql:\/\/localhost:3306\/loadtesting<\/span><\/li>\n<li><span style=\"color: #333333\"><strong>JDBC Driver class:<\/strong> com.mysql.jdbc.Driver.<\/span><\/li>\n<li><span style=\"color: #333333\"><strong>Username:<\/strong> root<\/span><\/li>\n<li><span style=\"color: #333333\"><strong>Password:<\/strong> root<\/span><\/li>\n<\/ul>\n<\/li>\n<li>JDBC Connection Configuration can seen in screen shot.<br \/>\n<a href=\"\/blog\/wp-ttn-blog\/uploads\/2015\/04\/Jmeter_config.png\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-19241 aligncenter\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/04\/Jmeter_config.png\" alt=\"Jmeter_config\" width=\"547\" height=\"391\" \/><\/a><\/li>\n<li><span style=\"color: #333333\"><b>Listener<\/b>\u00a0type: select\u00a0Add &gt; Listener &gt; View Results Tree.<\/span><\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p><span style=\"font-size: large;color: #ff9900\">Save and Run Test Plan<\/span><\/p>\n<p><span style=\"font-family: 'Liberation Serif', serif;color: #000000\"><span style=\"font-size: large\">Save the test as mydatabase.jmx and execute this test plan using Run &gt; Start option.<\/span><\/span><br \/>\n<span style=\"font-size: large;color: #ff9900\">Output<\/span><\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2015\/04\/jmeter_2.png\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-19239 aligncenter\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/04\/jmeter_2.png\" alt=\"jmeter_2\" width=\"551\" height=\"309\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<address>Thanks<\/address>\n<address>Prashant Sharma<\/address>\n","protected":false},"excerpt":{"rendered":"<p>In this blog we will setup the jmeter and we will see how to create a simple test plan to test the database server.We will use MySql database server for our test purpose or you can use any-other database. Setup requirement Download the latest jmeter\u00a0from here and untar jmeter in you home directory. Download\u00a0JDBC driver [&hellip;]<\/p>\n","protected":false},"author":120,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":32},"categories":[1174],"tags":[4843,696,1767,76],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/18912"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/120"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=18912"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/18912\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=18912"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=18912"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=18912"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}