Skip to content
Advertisement

Karate ReferenceError: package is not defined

I’m using java codes in karate feature file, refering github demo:

JavaScript

I noticed that the feature file is in src/test/java, which defined as classpath in pom.xml. Meanwhile the util class is in src/main/java.

In my project I use similar structure

enter image description here

Following code is in the feature file with Class Reference:

JavaScript

But I got an exception below:

JavaScript

Is it a classpath problem?

Advertisement

Answer

Aren’t you missing the quotes (for a string argument to Java.type()

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement