Dealing with file downloads
It is not uncommon to come across scenarios where you need to simulate downloading a file or multiple files from an external server when recording your test scripts. JMeter provides the ability to record and play back file downloads.
How to do it…
In this recipe, we will cover how to use JMeter in a file download scenario. Perform the following steps:
- Launch JMeter.
- Add Thread Group to the new test plan by navigating to Test Plan | Add | Threads (Users) | Thread Group.
- Add the HTTP Request sampler by navigating to Thread Group | Add | Sampler | HTTP Request.
- Fill in its attributes in the following way:
- Server Name or IP:
docs.spring.io
- Method:
GET
- Path:
/spring-data/jpa/docs/1.5.x/reference/pdf/spring-data-jpa-reference.pdf
- Server Name or IP:
- Add the View Results Tree listener to the test plan by navigating to Test Plan | Add | Listener | View Results Tree.
- Add Save Responses to the file listener of your test script by navigating to Test plan | Add | Listener | Save Responses to file...