Apache JMeter


 

.

Contents:

The Apache JMeter™ application is open source software, a 100% pure Java application designed to load test functional behavior and measure performance. 

It was originally designed for testing Web Applications but has since expanded to other test functions.

Apache JMeter may be used to test performance both on static and dynamic resources, Web dynamic applications.

It can be used to simulate a heavy load on a server, group of servers, network or object to test its strength or to analyze overall performance under different load types.

Apache JMeter features include:

  • Ability to load and performance test many different applications/server/protocol types:
  • Web - HTTP, HTTPS (Java, NodeJS, PHP, ASP.NET, …)
  • SOAP / REST Webservices
  • FTP
  • Database via JDBC
  • LDAP
  • Message-oriented middleware (MOM) via JMS
  • Mail - SMTP(S), POP3(S) and IMAP(S)
  • Native commands or shell scripts
  • TCP
  • Java Objects

Download JMeter Portable

You may need to unblock the program. Refer the picture.

Run (double-click) the PAF program. Specify target folder for JMeter program extraction e.g. "C:\portable\". The computer will create the folder if it does not exist.

After extraction process is completed, run the program.

Change the look and feel of JMeter Program by selecting menu Options/Look and Feel/...

Start by using the pre-defined test templates, i.e. selecting menu File/Templates ..., and then select Building a web test plan. Click Create button.


The template is loaded to the left panel. Build Web Test Plan item consists of 5 sub-items:

  • Scenario 1
  • Home Page
  • ThinkTime1s
  • Page Returning 404
  • View Results tree


Click the Run button (save your test plan as "build-web-test-plan-1.jmx").

Observe the View Results Tree text.

The outputs are corresponding to the 2 HTTP Requests in the test plan i.e. "Home Page" and "Page Returning 404"


Observe the View Results Tree Sampler.

The Sampler result shows the details of execution tasks

Observe the result tabs.

  • Request
    • Request body
    • Request header
  • Response data
    • Response body
    • Response header


Further reading: 
https://jmeter.apache.org/usermanual/component_reference.html#View_Results_Tree


JMeter is used primarily to test client-server system. 

A client-server system is a computing system that is composed of two logical parts: a server, which provides services, and a client, which requests them. 

The two parts can run on separate machines on a network, allowing users to access powerful server resources from their personal computers.

C. Testing Client-Server System

No

Instruction

0

Preparation


Download Virtual OS (Xubuntu Linux OVA)

https://archive.org/download/web-server/XubuntuFocal.zip 


Download XAMPP

https://archive.org/download/web-server/xampp-linux-x64-1.8.2-6-installer.run (LINUX)


Install XAMPP

https://setup-steps.blogspot.com/2022/04/how-to-install-xampp-in-ubuntu-xubuntu.html 

https://setup-steps.blogspot.com/2022/04/how-to-fix-xampp-installation-error-in.html

https://setup-steps.blogspot.com/2022/04/how-to-fix-xampp-launcher-in.html

Install Chrome

https://setup-steps.blogspot.com/2022/04/how-to-install-chrome-in-ubuntu-linux.html

https://setup-steps.blogspot.com/2022/04/how-to-fix-broken-installation-of.html

1

Run XAMPP

In Windows, run terminal command:

xampp-control.exe

(https://www.wikihow.com/Start-XAMPP-at-Startup-in-Windows)

In Linux, run terminal command:

(https://www.codegrepper.com/code-examples/shell/how+to+start+xampp+control+panel+in+ubuntu)

2

Test Apache (PHP) Server:

http://localhost/xampp:80 

3

Test Tomcat (Java) Server:

http://localhost:8080/

4

Test MYSQL Database Server:

http://localhost:80/phpmyadmin 

5

Test FTP Server:

ftp://localhost

This XAMPP Server can be used to test the functionalities of JMeter.

C. Testing Client-Server System



JMETER - BUILDING A WEB TEST PLAN

Objective

Create a basic Test Plan to test a Web site.

Task

Create five users that send requests to two pages on a web site.

Run their tests twice.

i.e.

(5 users)

x (2 requests)

x (repeat 1 time)

= 10 HTTP requests

No

Instruction

1

Add a new test plan.

2

Rename the test plan as Web Test Plan.

Click the Save button.

3

Add a Thread Group element.

4

Enter parameters.

Name: JMeter Users

Number of Threads (users): 5

Ramp-up Periods (in seconds): 1

Loop count: 1

5

Add HTTP Request Defaults config element

The purpose of this item is to define the default parameter values to be used by subsequent HTTP Request items.

Enter parameters.

Server Name: demo.razzi.my

6

Add Cookie Manager  config element

Cookie Manager added.

7

Add HTTP Request sampler

Set parameters.

Name: Home Page

Method: GET

Path: /litecms/

(Note: No need to set Server Name as it will get the default name specified in Step 5)

8

Duplicate the Home Page request.

9

Set parameters.

Name: Admin

Method: GET

Path: /litecms/cms/

10

Add View Listener (View Results Tree).

View Results Tree listener added.

11

Save the test plan.

12

Run the test plan.

Request body for Home Page:

Request body for Admin Page:

Download example test plan file:

(Web Test Plan (litecms).jmx)

https://drive.google.com/file/d/10gEREwQTNFMNm6eY_tEc6cXG9w63K16r/view?usp=sharing 

NOTE.1


In this section, you will learn how to create a Form-based Test Plan.

JMETER - BUILDING A WEB FORM TEST PLAN

Objective

Create a basic Test Plan to test a Web Form site.

Task

Create five users that send requests to three pages on the JMeter Web site.

Run their tests twice.

i.e.

(5 users)

x (3 requests)

x (repeat 1 time1)

= 15 HTTP requests

No

Instruction

1

Continue from the previous tutorial (https://docs.google.com/document/d/1cg9RzhXA5GIsojhgea2XucqwtzpCpAcuzHNj2AEPSnQ/edit?usp=sharing )

or

download start up test plan file

(https://www.google.com/url?q=https://drive.google.com/file/d/10gEREwQTNFMNm6eY_tEc6cXG9w63K16r/view )

2

Add a new HTTP Request

Set parameters

Name: Login

Method: POST

Path: /litecms/cms/index.php

Request Parameters:

username=admin

userpw=admin

3

Run Test.

Download test plan file:

https://drive.google.com/file/d/1fs4xgLhO4rXYj9S5z_-d8yGxRpe35j0X/view?usp=sharing


Further reading:

NOTE.2


In this section, you will learn how to create a Database Test Plan.

JMETER - BUILDING A DB TEST PLAN

Objective

Create a basic Test Plan to test a database connection.

Task

Create 1 user that sends requests to the database.

Run their tests twice.

i.e.

(1 users)

x (1 request)

x (repeat 1 time)

= 15 HTTP requests

No

Instruction

0

Before running Jmeter, add a sqlite connector to Jmeter Libaries.

Download the connector, https://drive.google.com/file/d/1byDCKmJPwVgk3ZhfV60yiQch6DDd_oAe/view?usp=sharing 

Put this connector into the Apache Jmeter lib folder.

Download the test database,

https://drive.google.com/file/d/1LKOfSHaqPIda9Zg48KS3sMOa4Z3tyeZw/view?usp=sharing 

Put the test database into c:\test\

1

Add a new test plan.

2

Rename the test plan as Web Test Plan.

Click the Save button.

3

Add a Thread Group.

4

Add JDBC Connection Configuration config element.

5

Set connection parameters.

Variable name for created pool: testpool

Database URL: jdbc:sqlite:c:\test\userdata.sqlite

JDBC Driver Class: org.sqlite.JDBC

Connection Properties: journal_mode=wal

6

Add JDBC Request

7

Set parameters

Variable name of Pool declared in JDBC Connection: testpool

SQL Query Type: Select statement

SQL Query: SELECT * FROM phpsqlitecms_userdata;

8

Add View Result Tree listener.

9

Run test.

Download the test plan:

https://drive.google.com/file/d/1KhBiAxi4VuHlfuX_vLTmif5nXSXeaEPe/view?usp=sharing 


Further reading:

NOTE.3


Post a Comment

0 Comments