Tag: performance testing
Apache JMeter HTTP(S) Test Script Recorder
In this tutorial we are planning to explain step by step on how to record HTTP/HTTPS sessions.
- Go to JMETER_HOME/bin and start JMETER with jmeterw.cmd and jmeter in linux/unix.
- Select “Test Plan”, right click on “Test Plan” and add a new thread group: Add > Threads (Users) > Thread Group.
3. Select “Thread Group” right click, “Add –> Config Element –> HTTP Request Defaults”
4. In new HTTP Request Defaults element: Server name – enter “host to be tested”, path can be left blank.
5. Right click on the “Thread Group” and add a recording controller: Add > Logic Controller >Recording Controller.
6. Next, select WorkBench, Right click on WorkBench and add the recorder: Add -> Non-Test Elements -> HTTP(S) Test Script Recorder
7. On HTTP(S) Test Script Recorder, click the “Add” button in “URL Patterns to Include”. This will create a blank entry; enter “.*.html”. you can specify URL patterns to include and exclude such as *.html, *.js, which you would like to record.
8. Right click on “HTTP(S) Test Script Recorder” and add a listener: Add -> Listener –> View Results Tree
9. Return to HTTP(S) Test Script Recorder, and click the “Start” button at the bottom.
This will start the JMeter proxy server which is used to intercept the browser requests. A file called ApacheJMeterTemporaryRootCA.crt will be generated in jmeter/bin folder. Install this certificate in your browser.
Note: If you browser already uses a proxy, then you need to configure JMeter to use that proxy before starting JMeter, using the command-line options -H and -P.
Configure Firefox To Use JMeter Proxy
We will use Firefox as our browser when using the JMeter HTTP(S) Test Script Recorder because, unlike Chrome and some other browsers, it does allows you to override system-wide configuration for its proxy settings.
Configure Firefox to use localhost (127.0.0.1) on port 8080 as its proxy for all traffic by following these steps:
- Open Firefox
- Go to the Preferences menu
- Click on the Advanced tab
- Then Network tab
- In the “Connection” section, click on “Settings…”
- Select the “Manual proxy configuration” radio button
- Set HTTP Proxy to “localhost” and Port to “8080”
- Check “Use this proxy server for all protocols”
- Click OK and exit the Preferences menu
Note: When Firefox is configured to use JMeter’s Script Recorder as a proxy, it will only work properly if the Script Recorder is running.
Recording HTTP Requests
Now that our test plan’s HTTP(S) Test Script Recorder is running, and Firefox is configured to use it as a proxy, the HTTP requests that Firefox sends will be recorded. Let’s test it out.
In Firefox, go to your server’s homepage (the same server that you configured in your JMeter HTTP Request Defaults):
Now there should be a little triangle next to your Recording Controller. Click on it to expand and show the requests that it has recorded. You should see the HTTP requests that were recorded, depending on which URL Patterns you have included and excluded. Feel free to browse your site to record more requests.
As you can see, a lot of requests were created. You may refine the list of HTTP requests by simply deleting unwanted entries here.
If you do not see any entries under your Recording Controller, you will want to review your URL Patterns in the HTTP(S) Test Script Recorder (Hint: Remove all includes and excludes to record everything).
Once you are done recording, click the “Stop” button at the bottom of the HTTP(S) Test Script Recorder window. Note that Firefox will no longer be able to reach any pages (because it is configured to use port 8080 as a proxy)–configure it to use “No proxy” if you want to function normally.
Run Your Test Plan
Once you are happy with the test plan you have recorded, save it, then run it. It will function exactly like a manually created test, so you can configure it, delete, and add items to make it match your desired test case more closely.
How to execute Linux command or shell script from APACHE JMETER
Sometimes it is necessary for the load test to send a linux command to verify the content/file exists in the remote linux server. Every time it is not a fair idea to connect remote server by file server browsers like winscp ,putty etc… as it is a load test. In such situations JMETER offers a sampler called ‘SSH sampler’ . This sampler is introduced to communicate with the linux server over ssh shell . It will be definitely useful for both Functional and Performance Testers.
Apache Jmeter’s SSH Sampler:
Sampler which will connect to linux server and execute linux commands
Steps in detail:
1) Download SSH Sampler plugin from google’s website
2) Copy the jar to your local Apache Jmeter’s “lib/ext” folder.
3) Download “jsch-0.1.51.jar” and place it in your local Apache Jmeter’s “lib/” folder.
4) Open Jmeter-> ThreadGroup->Samplers-> SSH Command
5) Give hostname,username, password and the linux command to be executed
6) Run Jmeter
7) Capture results in ‘View Results Tree’
Here is the image for your reference:
Loadtesting Websphere IBM MQ server using JMETER
For Loadtesting Apache Active MQ , JMS-Point-to-Point sampler in Jmeter will help us. Think that you do not have JNDI settings and no apache activemq for JMS messaging, instead IBM Websphere MQ is in place. One day your manager is coming and asking you to test IBM MQ using open source testing tool as they do not ready to pay for small scale performance testing.
In that case , here is the steps to use Jmeter to load test IBM Websphere MQ.
The content here is pretty much precious and definitely it will save your valuable time 🙂
- Below are the Java and MQ jars needed. Download these jar files and place it under Jmeter’s libext directory. ‘jmeter-jms-skip-jndi-0.0.1.jar‘ is the jar contains the MQ declaration and coding to connect it. You can down it from the URL : ‘http://www.java2s.com/Code/Jar/j/Downloadjmeterjmsskipjndi001jar.htm‘
- Open Jmeter -> File-> New->TestPlan -> Add Thread Group
- Under Thread Group add Samplers->JMS Point-to-Point Sampler and configure the parameter. As given in the below Screenshot.
- Run Jmeter Script and Enjoy IBM MQ load testing .
GPerftool2.1 is Released
“GPerftools” is a profiler which is used by developers to build application with early findings of performance issue such as CPU usage and memory leaks and other performance issues.It is also used by Google.
The following link shows ,how google uses gperftools as a profiler
For GPerfTools Download and Documentation: