Search code examples
node.jsautomated-testspostmannewman

Convert response PDF to text and execute test script. (eg., check for specific string)


I have a Postman collection with multiple POST requests which returns PDF as response(content type "application/pdf").

I use node js to run this collection via newman. The script converts the pdf response to txt using "pdf-parse" and store it in file system.

I would like to run test scripts from postman collection request on this text file so that I can do string compare.


Solution

  • Approached it differently. Update the code to enhance the test script during runtime by replacing a standard string with converted pdf text which will be used for test evaluation. More info on https://stackoverflow.com/a/66631208/5038526