1

I am trying to calling a feature file with a javascript function. However, I have noticed sometimes exception "org.graalvm.polyglot.PolyglotException: java.io.FileNotFoundException" as it is trying to look in a different location path

here is what I am trying,

* def jsonPathExists =
    """
    function(personApplicant)
    {
      if ('BABLProperties' in personApplicant)
      {           karate.call('../reusableFeatures/restMethods/PatchRequestHelper.feature@patchLoanConditionsGeneric',{payload:RequestBody})
      }
    }
    """
    * def pathExists = jsonPathExists(personApplicant, RequestBody)

Below is the exception: If we notice the exception, it is trying to look into different path location. Can you advise if I am following anything wrong? Also I notice this sometime it does work for a different script with similar pattern.

org.graalvm.polyglot.PolyglotException: java.io.FileNotFoundException: C:\Users\ADMZN13\Workspace\benbroker_apitest\target\test-classes\loanApplicationApi\Patch..\reusableFeatures\restMethods\PatchRequestHelper.feature (The system cannot find the path specified)

  • com.intuit.karate.resource.FileResource.getStream(FileResource.java:98)
Shreyas
  • 67
  • 4
  • 1
    my only suggestion is read this part of the docs: https://github.com/karatelabs/karate#path-prefixes - so you can use `this:` etc. to force a relative-path search. personally I feel karate tests should NEVER do things like what you are doing, it just leads to unmaintainable tests, read this for more info: https://stackoverflow.com/a/54126724/143475 – Peter Thomas Mar 15 '23 at 01:10

0 Answers0