When working with data related systems, you will have to upload multiple documents as well as download documents and check if the downloaded documents is the same as you expected it to be.

When you call the API call for download and you have the same document in your system or your JMeter package then you can compared the content with the file that you have with you. As always you will have to use the response assertion to compare the file with the response you receive when you download the file from the application (you are testing).

The following call needed to be added in the response assertion of the Download API Call.

${__FileToString(/Users/testing-excellence/Perf/blog/json_file.txt,,)}

screen-shot-2017-02-02-at-3-26-48-pm

You can also a CSV Data config if you will have to compare the response with multiple downloads. Say you know that the download is going to be in order or you would like to make a specific call with a json value and you will need to make the call multiple times then you can use the above call for help.

You can have a CSV file with the names of the files(without extensions) with the respective json you need to to use the following call in the body

${__FileToString(/Users/testing-excellence/Perf/blog/${__eval(${json_file})}.txt,,)}
Where json_file as the CSV Data config variable.
screen-shot-2017-02-02-at-15-12-57

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s