NPGK
NPGK

Reputation: 31

Json path not found

I'm running a simple feature with karate DSL version 1.5.0.RC3 and Java 17. When I run the feature in Command Line: java -jar karate.jar src/test/resources/subdirectory/myfile.feature But I get the following error: js failed: 01: read ('classpath:myData.json') org.graalvm.polyglot.PolyglotException: not found: myData.json

Here bellow the feature

@myproject
Feature: login user

  Background:

    
    * def req = read ('classpath:src/test/resources/subdirectory/myData.json')


  Scenario: Login User



    Given url 'https://myUrl'
    And path '/mypath/'
    And header Content-Type = 'application/json'
    And request req
    When method POST
    Then status 201

I'm expecting a status code 201

Upvotes: 2

Views: 48

Answers (1)

Peter Thomas
Peter Thomas

Reputation: 58088

Maybe you should use file: instead of classpath:. Read the documentation to understand what they mean: https://github.com/karatelabs/karate#path-prefixes

For completeness of this answer, note that when you run java you can modify the classpath.

Upvotes: 1

Related Questions