Skip to main content


Showing posts from October, 2015

Database Test Plan with JMeter

Let us see how we can test the database in Jmeter using JDBC Request Sampler. In this tutorial we will use oracle jdbc driver. Required jar E.g. “ojdbc6.jar” is placed in <JMETER_Path>/lib. Prepare a Test Plan as shown below:
Here we have added: User Defined Variables – Defined the required parameters for Database ConnectionJDBC Connection ConfigurationThread GroupJDBC Request under Thread GroupBeanShell Sampler – To display the output of the JDBC Request.View Results Tree – To View the Results JDBC Request Sampler is used to send an JDBC Request to database. But before using this we need to setup the required JDBC connection and it is done via JDBC Connection Configuration element. Under JDBC Connection Configuration we have the below defined values: We defined the Variable Name as “JDBC_Pool”. The values required for Database Connection are defined in User Defined Variables and are used here. E.g: jdbc_url = jdbc:oracle:thin:@DB_Server:port:DB_Instance jdbc_driver = oracle.jdb…

Using a Custom Jar in BeanShell Sampler in Jmeter

Let us see an example on how we can use a custom Java classes and methods in JMeter BeanShell sampler. Outline of the steps: Write Java classes and methods in IDE tools like Eclipse or NetBeansCreate a Jar of the above projectImport the Jar to JMeter locationUse the Java method in Jmeter BeanShell samplerRun the test plan and check results
Let us see the above step by step: For getting the concepts clear, let us create an example class which will generate factorial of a given number. The number will also be a random number. Let us create a class containing the method to calculate a factorial and this will be used in JMeter. I created the method as below in eclipse. Here we have created new project “FactorialJar”. Under the project, we created two projects named as “FactClass” and “TestFact”. Under each class we created a Class called “Fact” and “Facttest”. Code for is as below: package FactClass; publicclass Fact { publicint facto(int f)        { int fact=1; for(int i=1;i<=f;i+…