1. Introduction
1.1 Purpose
The purpose of this blog is to provide information on how to pass parameters from external text file and use them in load tests.
1.2 Scope
Scope of this blog is to provide information on how to pass parameters from external text file and use them in load tests. This document will be used further to add more information on jmeter as and when we find more techniques on using jmeter for performance testing.
2. About JMeter Tool
Apache JMeter is a 100% pure Java desktop 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.
2.1 What can I do with it?
Apache JMeter may be used to test performance both on static and dynamic resources (files, Servlets, Perl scripts, Java Objects, Data Bases and Queries, FTP Servers and more). It can be used to simulate a heavy load on a server, network or object to test its strength or to analyze overall performance under different load types. You can use it to make a graphical analysis of performance or to test your server/script/object behavior under heavy concurrent load.
2.2 What does it do?
- Can load and performance test many different server types:
- Web - HTTP, HTTPS
- SOAP
- Database via JDBC
- LDAP
- JMS
- Mail - POP3
- Complete portability and 100% Java purity.
- Full Swing and lightweight component support (precompiled JAR uses packages
javax.swing.*
). - Full multithreading framework allows concurrent sampling by many threads and simultaneous sampling of different functions by separate thread groups.
- Careful GUI design allows faster operation and more precise timings.
- Caching and offline analysis/replaying of test results.
- Highly Extensible:
- Pluggable Samplers allow unlimited testing capabilities.
- Several load statistics may be chosen with pluggable timers .
- Data analysis and visualization plugins allow great extendibility as well as personalization.
- Functions can be used to provide dynamic input to a test or provide data manipulation.
- Scriptable Samplers (Bean Shell is fully supported; and there is a sampler which supports BSF-compatible languages)
2.3 JMeter is not a browser
JMeter is not a browser. As far as web-services and remote services are concerned, JMeter looks like a browser (or rather, multiple browsers); however JMeter does not perform all the actions supported by browsers. In particular, JMeter does not execute the JavaScript found in HTML pages. Nor does it render the HTML pages as a browser does (it's possible to view the response as HTML etc, but the timings are not included in any samples, and only one sample in one thread is ever viewed at a time).
3. How to Use JMeter to read from External files
Step 1: Go to jakarta-jmeter-2.3.2\bin directory and click on Jmeter.bat file to start the Jmeter
Step 2: Create a Thread Group and add it to the test plan
Step 3: Enter the appropriate number of threads and iterations
Step 4: Add a Sampler – Web Service (Soap) Request to the Thread Group
Step 5: Enter the Appropriate details in the Web Services (SOAP) request
Note: Don’t forget to uncheck the Memory cache checkbox and check the Read Soap Response check box.
Step 6: Add User Parameters to Thread Group (Pre Processors > User Parameters)
Step 7: Click on Add Variable and Enter the Information as Shown
ü Check the Update once per iteration check box
ü Enter the name of the variable , example msisdn
ü Enter the value under user_1 as ${__CSV Read(test.txt,0)}
ü Note that 0 indicates the index and you can increment it based on which value you have to read from the file
ü Note that you can also add users and pass different values.
Step 8: Create a Sampler HTTP Request for the Thread group.
Step 9: Enter the HTTP Request Details and add the Parameters to be sent to the request
Step 10: Add a Listener {View Results tree} to view the results
Step 11: Create a test.txt file and place it in jakarta-jmeter-2.3.2\bin folder. The file may look like;
Step 12: Save the Project
Step 13: Click on Run -> Start
Step 14: View the Results [Add the Listener as per your need]
Have a Happy Time Testing with Jmeter J J
No comments:
Post a Comment