Operations 5 min read

Introduction to JMeter: Architecture, Build Process, and Custom JSON Assertion Development

This article introduces JMeter as an open‑source Java‑based performance testing tool, explains its directory and code structure, describes how to compile and run it with Ant, and provides a step‑by‑step guide to extending JMeter with a custom JSON assertion and GUI component.

360 Quality & Efficiency
360 Quality & Efficiency
360 Quality & Efficiency
Introduction to JMeter: Architecture, Build Process, and Custom JSON Assertion Development

JMeter Introduction JMeter is a Java‑based distributed performance testing tool that supports multi‑threaded sampling and various protocols (HTTP, HTTPS, TCP, FTP, JDBC, LDAP, SMTP, POP3, IMAP, JMS, MongoDB, etc.). It is open‑source, free, cross‑platform, and highly extensible, making it a popular alternative to commercial tools.

Code Structure Overview The project consists of directories such as bin (executables and config files), docs-jmeter (documentation), lib (core JAR dependencies), src (source code for components, core, JUnit tests, functions, utilities, protocols, and monitoring), test (test cases), and xdocs (XML documentation). Key source sub‑folders include src/components (protocol‑agnostic components), src/core (core configuration and controller interfaces), src/junit (JUnit4 tests), src/function (utility classes), src/protocol (protocol implementations), and src/monitor (monitoring components).

Compilation JMeter is built with Ant. After downloading the source, run ant setup-eclipse-project to generate Eclipse project files, then import the project into Eclipse. The entry point is org.apache.jmeter.NewDriver , which uses reflection to launch the application.

Extending JMeter – Example: Changing Language By modifying the doAction() method to add a System.out.println("action to changeLanguage") statement, recompiling, and running JMeter, selecting the English language displays the new console output, demonstrating simple source modification.

Implementing a Custom JSON Assertion Since many services return JSON, a custom JSON assertion can be added. JMeter’s assertion framework (e.g., XMLAssertion, HTMLAssertion) requires implementing the core Assertion interface. The article outlines creating JsonAssertion and its GUI class JsonAssertionGUI , adding necessary code, and updating messages.properties for internationalization.

GUI Framework JMeter provides two GUI component models: one extending JMeterGUIComponent and another using Swing bean binding. The provided example shows the XMLAssertion GUI implementation as a reference.

Internationalization UI strings are defined in messages.properties , enabling localization of the new JSON assertion GUI.

Build and Test After adding the custom assertion code and resources, rebuild JMeter, launch it, create a test plan that uses the new JSON assertion, and verify the expected output (e.g., "theresultData is not the real format JsonString" when the response is not valid JSON).

Conclusion JMeter is a widely used, open‑source performance testing tool built on Java, offering flexibility for custom extensions such as new samplers or assertions. The next article will cover developing custom samplers.

JavaDevOpsPerformance TestingJMeteropen-sourceCustom Assertion
360 Quality & Efficiency
Written by

360 Quality & Efficiency

360 Quality & Efficiency focuses on seamlessly integrating quality and efficiency in R&D, sharing 360’s internal best practices with industry peers to foster collaboration among Chinese enterprises and drive greater efficiency value.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.