1

In karate framework, while executing one test case, getting error

java.lang.RuntimeException: cannot convert, not a json string: [type: INPUT_STREAM, value: java.io.BufferedInputStream@5f8890c2] at com.intuit.karate.Script.toJsonDoc(Script.java:619) at com.intuit.karate.Script.assign(Script.java:586) at com.intuit.karate.Script.assignJson(Script.java:543) at com.intuit.karate.StepDefs.castToJson(StepDefs.java:329) at ✽.* json vExpectedJSONObject = vExpectedJSONFileContent,

Acually in this framework, we are executing sql query and then result of that query is stored at abc.json file. but due to this error that result is not getting stored in that json file.

I have tired with multiple option like file incoding - set to utf-8 then adding plugin in to pom.xml.

json vExpectedJSONObject = vExpectedJSONFileContent, I am expecting the sql result should be stored in json file.

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248
Dream_hat
  • 51
  • 5
  • We have used Runtime.getRuntime().exec funtion to stored sql query output to json file. More surprisingly same code is working fine on other machine. – Dream_hat Sep 30 '19 at 14:32
  • Does this answer your question? [How to call python file in a feature file of karate automation?](https://stackoverflow.com/questions/66546381/how-to-call-python-file-in-a-feature-file-of-karate-automation) – Peter Thomas Apr 16 '21 at 13:22

1 Answers1

0

Finally got the solution:), Issue was related to framework setup, actually we are trying to call Runtime.getRuntime().exec funtion to execute our sql query by using command at cmd prompt. but due to some access privileges that command was not executing, so after debug, we have put that mysql.exe file into jre/bin folder and then it works....

Dream_hat
  • 51
  • 5