1

We have an API with just retrieves PDF from a Server. So when the API is hit, we get this as response.

In SOAP UI, there will be an attachment tab from which we can open the PDF file. Is there a way to do this in Karate.?

We are trying to move towards Karate enter image description here

1 Answers1

0

Being able to preview a PDF is for manual testing and Karate is a test-automation tool. So it is not supported and my suggestion is that you don't worry about this and move on. In my opinion this is not a mandatory requirement for you.

What is important is to be able to do a comparison. If you are doing an exact binary match, this is already possible, refer: https://stackoverflow.com/a/55147777/143475

You may be able to embed a PDF into an HTML report, refer: https://github.com/karatelabs/karate/tree/v1.2.1.RC1/karate-demo/src/test/java/demo/embed

Finally if you really insist on "opening" the PDF somehow during a test, you can use the ability of Karate to call command-line programs. For example open foo.pdf works on a Mac. Refer this: https://stackoverflow.com/a/62911366/143475

EDIT: Karate has visual testing in version 1.3.0 onwards, perhaps you can give this a try: https://github.com/karatelabs/karate#compare-image

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248