Customers Contact TR

The Importance of Testing and Apache JMeter

 

Greetings, I have not dealt with the testing of the projects until recently. I made tests via JMeter in the first month of my new job.

 

There are specific environments where a product is installed before it is live. The first one is the test environment. The product is set up in test servers in the first step. At this point, we look for answers to this question: “Are the expected responses for user-made requests received?” Of course, we do not work with real data at this stage. If there are problems, the product is corrected on the testing machine, and it continues to test the new version. If there is no problem, the results of the test cases are checked for other environments. A new version can be installed in the real environment if everything is smooth.

 

This blog post explains what JMeter is, the types of tests, and the primary test concepts.

 

JMeter, an Apache Software Foundation project, was initially designed to test web applications but later developed to perform different test functions. In JMeter web applications, it is possible to test static files such as HTML, CSS, and JS and as dynamically generated web services based on SOAP (Simple Object Access Protocol) and REST (Representational State Transfer). JMeter helps to simulate the web requests of real users while using a web app.

 

Since JMeter is entirely written in Java, it can run smoothly on Linux, Windows, or Mac OS as long as Java Runtime Environment (JRE) or Java Development Environment (JDK) is installed.

 

Types of Testing

 

* Functional Testing

 

Tests the functional accuracy of the service provided. Some functional tests to be performed in a web application where the exam results are presented to the students: each student is querying their exam results, having no authorization to query other’s exam results, returning own results, returning no results for students who did not take the exam, and returning information that the student has not taken the exam.

 

* Load Testing

 

Observes how an application behaves under a specific load (delay in responses, user experience, etc.).

 

* Performance Testing

 

Tests whether the application is running within the scope of planned performance criteria. Each application should have a specific performance target. For example, a website’s resources (number of servers, server properties, network bandwidth, etc.) are planned according to the maximum number of users expected for a particular period (for example, 1 minute). Performance tests simulate a website’s performance realistically and ensure that the system can still be stable when it reaches the maximum number of users.

 

* Stress Testing

 

Observes how the system behaves when the load is above the planned maximum capacity, and most importantly, at what point it breaks. The expected behavior is that the application stops performing partially or entirely when the load is high but becomes stable after the tests are over.

 

Test Concepts

 

* Ramp-up Time

 

Let’s assume we intend to test our application with a sample of 1000 users. It is not realistic to get all 1000 of 1000 users in the system right away. Ramp-up time determines how many users the test tool includes in the system each second. When the ramp-up time is 20 seconds for 1000 users, the system adds 50 users at the end of the 1st, and 100 users at the 2nd second. At the end of 20 seconds, the system includes all users in the test.

 

* Think Time

 

Computers process very quickly, unlike people. Real users need some time between two test steps to log in using a mouse/keyboard. To simulate this user behavior in the test scenario and make the virtual user (the test user) wait between two steps, we use a timer. Defined waiting time between two test steps is called Think Time. For example, the actual user who loads the page containing an HTML form needs a certain amount of time to fill out before submitting the form.

 

* Loop Count

 

Let’s suppose we intend to add 100K users to our test within 10 minutes and run a one-minute process. Instead of setting ramp-up time as 10 minutes per 100K users, we can add 10K users in the system for 1 minute and repeat the process ten times in total for each user. Loop Count is the total number of entries for each test user in the system.

 

JMeter Interface and Basic Usage

 
 

The image above is the first screen of JMeter.

 

We can easily add a test with Sampler. (Add->Sampler->HTTP Request)

 

When we add a test name, we must fill in the server name or IP to forward our request and the path we request from the webserver.

 
 

Once the test’s query content is added, it can check whether the tests are working correctly and make corrections to the tests as follows;

 
 

Good luck!


Author: Kartaca