A product to meet the definition of done, it should pass both NFT and FT. Here are some ideas to use JMeter for NFT.
JMeter is one of the open-source tool that can be used for Analysing and measuring performance. It’s one of the best tool which is mainly used for website load testing. It is pure java based application so it can run on different platforms.
Chain of steps that JMeter is going to execute while pressing the run button. A complete test plan will contain one or more Thread Groups, logic controllers, sample generating controllers, listeners, timers, assertions, and configuration elements.
- Adding Elements :
Elements can be added to the test plan by clicking the Test plan node > choose the element from “Add”
- Removing Elements:
We can remove the elements by Selecting the element > click the element > choose and click the Remove option.
- Saving the test plan.
We can save the test plan by clicking the file menu > Choose and clicking “Save” or “Save Test Plan as” option
- Running the test plan:
We can run the Test plan by Click Run menu > choosing “Start” or (Command + r). When it start running it shows a small green box at the right-hand end of selection the Under the menu bar.
- Stopping a test:
We can stop the test plan in two ways, which are “Stop” and “Shutdown” When we use Stop It stops immediately (Force stop). If we use Shut down it requests threads to stop at end of current work.
Some Elements of Test plan:
- Thread Group
- Controllers (Logical controller and samplers)
Thread Group :
The Thread Group is a beginning point of any Test Plan and it is an element which controls the number of threads, It will use and execute your test all controllers and the samplers should be included in a thread group.
Other elements like listeners may be placed directly Under the test plan so that it will be applicable for the thread groups under the test plan.
Properties of Thread groups :
Number of threads :
It means the number of concurrent users or connections to your server application.
Ramp-up Time :
It defines the amount of time it will take JMeter to add all threads to test execution. (Time taken to thread up and running = Ramp up period / Number of Thread )
Loop count :
This meansthenumber of times to run the test.
2. Controllers :
Controllers are responsible for test processing.
- Logical controller :
Logical controllers allow customising of JMeter requests such as when to send requests to the server. It’s used for logic that contains Looping, Such as If controller, while controller, Include controller, switch controller, Loop controller etc…
Thread group > Add > Logic controller > choose Logic controller
- samplers :
The samplers intend JMeter to send a request and wait for a response. If multiple samplers are present in the Test tree. It’s executed in the order they present in the tree. The request is processed by the server and its response is returned to J Meter, it can be viewed and analysed in terms of different performance parameters like response time, Hits per second etc…
Thread group > Add > Sampler > choose samplers
JMeter samplers include:
JDBC Request ..etc
When the JMeter runs the test cases, there will be some sort of informations that will be obtained as a byproduct of the execution of the test cases. The information can be accessed with the help of a Listener. The Executed results in JMeter can be viewed by using Listeners.
The Test plan should have listeners, Which are added to check and analyse the executed results, Listeners are an important part of J Meter’s test plan
JMeter has several listener options :
View result tree
View result table
Response Time graph etc…
4. Timers :
Timers allows delay of the samplers execution in J Meter, The program will executes them sequentially without any delay between requests. If there are no timers, Which is used to delay the next request by a constant time which you can configure by adding the value of delay time.
The following timers are available in J Meter:
Bean shell Timer
Uniform Random Timer Etc…
5. Assertions :
Assertions are nothing but saying in a very confident manner JMeter to certify something, Assertions are used to verify and validate the data of requests that we have sent to the server. Using assertion to compare the expected results with actual.
Types of assertions :
Bean shell Assertion etc…
How to execute a test plan with some elements :
HTTP Request (WEB Test plan)
In JMeter HTTP Request is one of the samplers. You can send an HTTP/HTTPS Request to a web server for load testing and we can also use this by different methods like GET, POST, PUT.
Step 1: Open JMeter
Start JMeter > Open JMeter by terminal > Rename the test plan as “Web test “
Step 2: Add Thread Group
We can add the first element in the window. Add one thread group which is a placeholder for all other elements like samplers, listeners etc…
Click the element where you want to add the child element node.
Click on Web test (Test plan) > Add > Threads > Thread group (Thread group should be under our test plan (Web test)
Step 3: Add Sampler
We need to add one sampler under the thread group.
Click thread group > Add > Sampler > HTTP request option
Name – Change the name to reflect the action that we want to achieve.
Server Name or IP – Here we type the web server name, for Example: www.mallow-tech.com
Protocol – Keep it blank, If we want HTTP as a protocol. Otherwise will change the HTTPS
Method – Keep it as GET We can use different methods like GET, PUT and POST etc…
Path – Will keep empty. If we need any root page we can enter the address.
Step 4: Add listeners
We need to add a listener to view results, Let us add a view results tree listener under the thread group. It ensures the results of the sampler will available to view in this listener node element.
Open context menu > Click the thread group > choose Add > choose Listener > View Results Tree option
Step 5: Run the test plan and View the output
Let us execute the test plan after all setup. Click Run > choose and click the start option
JMeter asks us to save the test plan in a disk file before executing the test. If we want to run multiple times we can save otherwise we have the option to run without saving.
We can view the results by the listener ( View results tree). Green colour against the name visit mallow home page indicates success. Jmeter has stored all the responses sent by the web server and shows us the result in many ways, The following points are separated by tabs.
- Sampler result – It shows data as the same as returned by the web server.
- Request – All the datas are sent to the web server as part of the request.
- Response data – The listener showed the data in text format.
Raghavan Testing Team
Mallow Technologies Pvt Ltd.