如何使用JMeter对Acrobat Reader(独立版)进行性能测试?(含PDF授权页面捕获与登录处理需求)
Got it, let's walk through how to implement this performance testing scenario step by step—this approach will help you capture the authorization flow and validate PDF loading performance effectively:
1. Pre-Requisites Setup
First, get your environment ready to capture Acrobat's network traffic:
- Fire up JMeter and make sure you have the HTTP(S) Test Script Recorder component installed (it's included by default in modern JMeter versions).
- Configure your Acrobat Reader to use JMeter as its proxy:
- Open Acrobat > Go to
Edit > Preferences > General > Select "Internet" - Set the proxy server to
localhostand port to8080(JMeter's default recorder port—adjust if you changed it).
- Open Acrobat > Go to
- Install JMeter's root CA certificate to capture HTTPS requests:
- In JMeter's recorder, click
Generate Root CAand save the certificate file. - Install this certificate in your system's trusted root store (steps vary by OS: Windows uses Certificate Manager, macOS uses Keychain Access).
- In JMeter's recorder, click
2. Record the Authorization & PDF Loading Flow
Now capture the end-to-end user journey:
- In JMeter, create a new Test Plan > Add a Thread Group (right-click Test Plan > Add > Threads (Users) > Thread Group).
- Add the HTTP(S) Test Script Recorder (right-click WorkBench > Add > Non-Test Elements > HTTP(S) Test Script Recorder).
- Set the target controller to your Thread Group (under "Recording Settings" > "Target Controller" dropdown), so all captured requests go directly into your test plan.
- Start the recorder, then open Acrobat Reader and load your target PDF. Complete the login on the pop-up authorization page, and wait for the PDF content to fully load.
- Stop the recorder in JMeter—you'll now see all the captured requests in your Thread Group.
3. Clean Up & Refine the Recorded Script
Next, polish the script to remove noise and handle session persistence:
- Remove irrelevant requests: Delete any requests that aren't part of the authorization or PDF loading flow (e.g., Acrobat update checks, analytics pings).
- Handle session authentication:
- Add an HTTP Cookie Manager to your Thread Group (right-click Thread Group > Add > Config Element > HTTP Cookie Manager). This will automatically capture and reuse session cookies after login, so subsequent PDF requests are authorized.
- If the app uses tokens (like JWT) instead of cookies, use a Regular Expression Extractor or JSON Extractor to capture the token from the login response, then reference it in headers for PDF loading requests.
- Parameterize credentials (for multi-user testing): Add a CSV Data Set Config (right-click Thread Group > Add > Config Element > CSV Data Set Config) to load multiple username/password pairs from a CSV file, replacing the hardcoded values in your login request.
4. Add Validation & Performance Metrics
Ensure your script validates success and captures key performance data:
- Add assertions: For the PDF loading request, add a Response Assertion (right-click the request > Add > Assertions > Response Assertion) to check for:
- A 200 OK response status code.
- A unique string from the PDF content (e.g.,
%PDF-1.7in the response body, which indicates a valid PDF).
- Add performance listeners: Include listeners like:
- View Results Tree (for debugging single-thread runs).
- Aggregate Report (to view average response times, throughput, error rates).
- Summary Report (for a high-level overview of test results).
- Simulate realistic user behavior: Add a Constant Timer or Gaussian Random Timer (right-click Thread Group > Add > Timer) to simulate the time users spend filling out the login form (e.g., 2-5 seconds).
5. Validate & Execute the Test
Before running a full performance test:
- Run the script with 1 thread first to verify the flow works: Check the View Results Tree to ensure login succeeds, the PDF loads, and all assertions pass.
- Once validated, adjust the Thread Group settings to simulate your desired load:
- Set
Number of Threads (users)to the number of concurrent users you want to test. - Set
Ramp-Up Periodto control how quickly users are added (e.g., 10 users over 10 seconds = 1 user per second). - Set
Loop Countto define how many times each user repeats the flow.
- Set
- Run the test and analyze the metrics in your listeners to identify bottlenecks (e.g., slow login response times, high error rates during PDF loading).
Bonus Tips
- If the authorization pop-up uses a web view (common in Acrobat), make sure all requests from that web view are captured by the recorder.
- If your test environment uses CAPTCHA for login, work with your dev team to disable it for testing—CAPTCHA is not feasible to automate in JMeter without third-party tools.
- For large PDF files, monitor JMeter's memory usage to avoid out-of-memory errors (increase heap size in
jmeter.bat/jmeter.shif needed).
内容的提问来源于stack exchange,提问作者Arun
相关产品推荐
相关产品推荐

