Recording Jmeter Scripts behind a proxy server
Recording Jmeter
Scripts behind
a proxy server
In one of the blog
we saw the steps of recording Jmeter scripts using a proxy server.
JMeter has its
own in-built Proxy Server, the HTTP(S) Test Script Recorder. This is only used for recording HTTP or HTTPS
browser sessions as explained in below link.
If we are testing from behind a firewall/proxy server or if we the internet access is provided using proxy server then the above steps will fail and will not record any of the steps.
Steps to record in Jmeter if the internet is accessed via proxy:
1. Start Jmeter with the
firewall/proxy server hostname and port number.
To
do so, Open a command prompt in windows and run the jmeter.bat file from a
command line with the following parameters:
-H [proxy
server hostname or ip address]
-P [proxy server port]
-N [nonproxy hosts] (e.g. *.apache.org|localhost)
-u [username for proxy authentication - if required]
-a [password for proxy authentication - if required]
-P [proxy server port]
-N [nonproxy hosts] (e.g. *.apache.org|localhost)
-u [username for proxy authentication - if required]
-a [password for proxy authentication - if required]
Example: jmeter -H comproxy.server -P 8080
-u username -a password -N localhost
You can
also use --proxyHost, --proxyPort, --username, and --password as parameter
names
2. In this exercise instead of
recording under WorkBench, let us record the requests under TestPlan. Once the
Jmeter is launched
Add
Thread Group under Testplan by following the steps as
Right
Click on Test Plan -> Add -> Threads (Users) -> Thread Group
3. Now Right Click on WorkBench
-> Add -> Non-Test Elements -> HTTP(S) Test Script Recorder
4. Under Global Settings of HTTP(S)
Test Script Recorder provide the port as 6500.
Note: Here we are setting proxy which
is only used for recording HTTP or HTTPS browser sessions. This is not to be
confused with the proxy settings described above, which is used when JMeter
makes HTTP or HTTPS requests itself.
Change
the Target Controller to “Test Plan -> Thread Group”
Also
Select the Grouping as “Put each group in a new transaction controller”
5. Now we need to change the proxy
setting of our machine to records using the proxy port 6500. To perform the
steps:
Open
IE - >Internet Options -> Connections -> Lan settings
Under
Proxy Server, Enter Address as “localhost” and Port as “6500” and click OK
6. Now in Jmeter Click on “Start”
under HTTP(S) Test Script Recorder. Once we click on start a message will be displayed
as below:
In
Jmeter/bin directory a certificate will be present.
7. Now go to IE and open the
required webpage to record. For example,
open www.google.com
8. If the certificate is successful
and has now issue, the steps will be recorded as shown below:
Some
times if recording for the first time using Jmeter proxy we will get an error
for certificate as “There is a problem with this website's security
certificate.”. In that case we need to import the certificate from step 6 to
the Internet Options -> Content -> Certificates and Import the correct
certificate.
Once
recording of the required steps are completed, stop the HTTP(S) Test Script
Recorder.
Also
change the proxy settings to the original settings to access internet.
This is what i am looking for since long time for my project. Thanks for your help it will very use full for my semi dedicated proxies project which is based on proxy server.
ReplyDeleteThank you so much.... I was looking for this since long time.... Really appreciated
ReplyDeleteif you change your proxy, how can you get access to external websites? I am testing behind a proxy and trying to record non internal website. Does your advice relate to testing local/internal sites?
ReplyDelete👉check the latest and new proxy sites...
ReplyDeletefresh unblocked proxy sites
unblock proxy sites list
unblock blocked websites
unblock youtube
unblock blocked websites online
I like it and help me to development very well.Thank you for this brief explanation and very nice information.Well, got a good knowledge.
ReplyDeleteSalesforce Training in Chennai | Certification | Online Course | Salesforce Training in Bangalore | Certification | Online Course | Salesforce Training in Hyderabad | Certification | Online Course | Salesforce Training in Pune | Certification | Online Course | Salesforce Online Training | Salesforce Training