JMeter testing
JMeter is a testing tool to simulate thousands of users for web testing purposes. It uses Java Threads for this.
JMeter is a testing tool to simulate thousands of users for web testing purposes. It uses Java Threads for this.
We’re going to use a test app. Supposedly, this app has passed a first development iteration, and has passed unit and functional testing. With JMeter we measure its performance.
Performance testing should start early and continue through the whole dev process.
JMeter is not a browser. It doesn’t execute JavaScript!
Performance is related to how fast an app executes an operation. Performance testing is about how an app or resource performs under a given load, to see its impact. It should be done after the app has passed all functional tests and we’re sure it works correctly.
Performance testing is measured in terms of:
scalability: tells how well the system expands its capacity in terms of response time, throughput and reliability when additional resources are added.
They’re are usually set up in contracts, such as:
Almost always you should execute a smoke test first. This is a test with light load to verify the test works correctly.
A load test is a test that’s performed at a specific load level. Usually you’ll perform them at many load levels to monitor the app’s behavior.
A stress test tests the app with loads past its normal working range, to see up to which point it stays stable and responsive.
At a spike test the app is subjected to brief periods of sudden increments in the load beyond its maximum capacity, to see if the app is robust enough to work during and after the spike.
Endurance tests, where the app is subjected to load within its limits for a long duration (hours or even days) to search for memory leaks.
JMeter is a testing tool to simulate thousands of users. It uses Java Threads for this.
In JMeter the components of a test are organized in a tree, where each component has a scope that determines to what other components it has access to.
Test Plan is the root element of a test, where all overall settings are specified and all the other elements are contained.
It allows us to:
They’re the entry point of a test and controls the number of threads (users) JMeter will use to execute a test. We also have setUp and tearDown Thread Groups.
We may:
They’re used to set up default configurations and variables for later use by other components. They can be placed under any other component.
They are classified into:
The most common used are:
He created an HTTP Request Defaults and added the IP and port number, so he doesn’t need to repeate this at every component.
The only thing it does, it’s to do a bit easier to test and assert for exceptions in a Test Driven Development-like way. To use together with AssertJ. It only has two methods which are useful to me:
// When
BDDCatchException.when(this.instance)
.methodWhichThrowsException();
// Then
Assertions
.assertThat(BDDCatchException.caughtException())
.isNotNull()
.isExactlyInstanceOf(IndexOutOfBoundsException.class);