1

I am trying to write my contents into an external file. How to define your file path in the Karate.write(value, file) ?? (I am aware that it is not recommended from the framework perspective but I have to do some JMS activity with my customised Java functions. That is why I am trying to do this)

Deepak Prabhu
  • 219
  • 1
  • 4
  • 15

1 Answers1

0

Anyone coming across this answer in the future, please read this first: https://stackoverflow.com/a/54593057/143475

Even if you need to do JMS, I don't understand why you need to write a file. Read the above link again if you need to please. Also Karate has support for async and we even have a JMS example here: https://github.com/intuit/karate/tree/master/karate-netty#consumer-provider-example

Finally: my strong advice to you: write a Java or JS utility yourself. Look at this example for hints: upload.feature especially this part:

* def FileChecker = Java.type('com.intuit.karate.demo.util.FileChecker')
# example of parsing a string into json by karate
* json fileInfo = FileChecker.getMetadata(id)

Here we are reading a file, but you get the idea.

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