DAMLA IYILIKSEVER | BUSINESS ANALYST
In my previous blog post I’ve mentioned software test tools. Now, I aim to promote you to you’re your own tests on your web applications by giving basic information about JMeter. JMeter is made by 100 % Java codes and you should have related libraries to be able to use it as I specified in my previous post. It provides you to make your web applications’ performance, load, and functional tests. Let’s start to examine JMeter with its basic features and the involved contains.
- Thread Group: It is the first step of each test group and the all other elements of test plan should be under Thread Group. Determining number of users, ramp-up and loop count is allowed by this section. I think explaining it here necessary with an example to make you clear; for example, you have 100 users and expect 10 of them launch at the same time when you start your test. Then, we can say that 100/10=10 sec is your ramp-up period time. This means first 10 users launch in the first sec, 20 users launch at the end of 2nd sec, 30 users launch at the end of 3rd sec and make your test. At the end of 10th second, your whole users will be launched and finish the test. JMeter brings “Forever” option ticked in default which signs your test will be tested with endless loop but even so, you’re able to change it. Test Run Scheduler placing 1.9 version allows you to add start and end time.
- Controllers: They can change order and queue of your test and can be bottom element of Samplers, Config Elements or Logic Controllers. The point to be considered is that controllers can change the request itself and thus, JMeter may fall into repetition.
- Configuration Element: It is used for configuring and changing samplers which are made a request to the server. You should put it on samplers’ top level that you want to structure. Let’s view some of frequently used of them:
- CSV Data Set Config: It reads data from an external CSV file, writes them in variable fields and uses them sampler request.
- User Defined Variables: It is used for creating variables to be used.
- JDBC Connection Configuration: It is used for creating JDBC connection settings with JDBC Request sampler and also it is used for creating a database test plan.
- Login Config Element: It is used for creating default credentials for samplers using username and password.
- Listeners: They’re used for viewing and analysing performance test results in tabular or graphical forms. Besides, it provides users different time metrics with each other. Let’s look into the ones frequently used:
- Aggregate Graph: It is used to view test results in both tabular (report form) and graphical form.
- View Results in Tree: It is used to store and provide test results for each samplers. You can display the whole response body, response header, request sent to server and their bodies here.
- View Results in Table: It is one of listeners that you can reach response header, latency, sample time etc.
How to Test Web Services with JMeter?
As usual, progressing will be developed through Test Plan. You should assign user/s to your test plan that you’ll actualise. Therefore, Thread Group to be created by you will be worked for you. The number of users and information belonging to some tests I mentioned above can be changed here. And after that step, we can start with the requirements of testing a service; for example, “where should I send my request to and from?” question should come to our mind as first. HTTP Request from Sampler that provides you to create your request details and revise in it will help you about your question. Here, you introduce Server/IP and your request will be forwarded through a specific port to a server you want to send and you’ll be able to get a response. And also you can define, match or associate values you can see in the Result section in addition to the request you have in the Parameters section. The only thing you should do is running your test plan and finding your test results in Sampler Result under View Results in Tree section.
How to Config JDBC (Java DataBase Connectivity) Connection?
I am sure that you have a test environment to store data on your web applications that you want to test and also you need to retrieve data from there and write this data on an external file. All of these works I mentioned above can be executed via JDBC configuration.
Firstly, you should specify number of Thread Group (users) and their features over test plan that you want to actualise. They are the next requirements that you should add JDBC Request from Sampler and JDBC Connection Configuration allowing you to make your settings. You should run your test plan after typing Database URL and JDBC Driver Class info into their field, your query into the request query field. As always, you can view your results from the View Results in Tree listener.