reading karate config in mock server

Viewed 36

I am trying to read the karate config in my mock server as per the documentation at https://karatelabs.github.io/karate/karate-netty/#background

Feature: stateful mock server

  Background:
    * call read('classpath:karate-config.js')

  Scenario: pathMatches('/api/xml') && methodIs('post')
...
...

However i get an error on the line the call read is placed.

js failed:
>>>>
01: start('validateLocalCps.mock')
<<<<
org.graalvm.polyglot.PolyglotException: mock-server background failed - /cas_testing/auth/target/test-classes/auth/token/validateLocalCps.mock:4
- com.intuit.karate.core.MockHandler.<init>(MockHandler.java:116)
- com.intuit.karate.core.MockServer$Builder.build(MockServer.java:132)
- com.intuit.karate.core.ScenarioBridge.startInternal(ScenarioBridge.java:855)
- com.intuit.karate.core.ScenarioBridge.start(ScenarioBridge.java:817)
- <js>.:=>(Unnamed:1)


classpath:auth/token/validateLocalSuccess.feature:7

I am using karate version 1.2.0

My karate-config.js is inside src/test/java where as the feature files and mocks are inside other subdirectories.

How should i write this call so that i can read the config from my mock.

1 Answers
Related