Sometimes it is necessary to parameterize dynamic file upload. The recorded request typically will be a multipart post request where one of the fields has a value containing the file content. For example, the request will look like:
Content-Disposition: form-data; name="submittedfile"; filename="recorded.pdf"
7052 0 obj
The field "submittedfile" here represents the recoded content of the file. In the course of load testing, you want to replace this content with dynamically selected files with the content of the files available locally on the load testing machine. To do so, create a dataset with a field for storing the paths of such files. Then parameterize the multipart request by replacing the value of the field with the recoded file content (in this case, "submittedfile" field) with the dataset.
In order to parameterize the field with file content, the dataset column data must store the file path.
The path of the file can be in one following format:
- The full path of the file (ex. c:\myfolder\Document001.pdf). Use this format for local tests.
- The local path of the file if the file is stored in the local DataFiles directory (ex. \Authorized\Document001.pdf) if the path is in <test directory>\DataFiles\Authorized\Document001.pdf). Use this format for distributed tests.
The files in the DataFiles directory are copied to all agents before the test starts.
The screenshot below shows an example of parameterizing a recorded pdf file upload.
- The recorded file will be parameterized with files inside the <test directory>\DataFiles\Authorized folder. Document001.pdf, Document002.pdf, etc...
- Create a dataset named PDF-Files with a column RelativePath.
- Fill the column with relative paths of the pdf files to upload \Authorized folder. Document001.pdf, \Authorized folder. Document002.pdf, etc...
- No labels