1

I'm running karate tests in Visual Studio Code and I get the following failure. I've compared the VSCode file structure and content to our working Eclipse setup and don't find any differences. Why does VSCode fail? I am running a stand-alone karate instance.

Karate version: 0.9.5.RC5...
security.codes.CodesEdit: -unknown-:6 - javascript evaluation failed: Java.type('util.SqlConnection').getInstance(), java.lang.ClassNotFoundException: util.SqlConnection

The feature file is located in src/test/java/security/codes and the call to the class not found is:

Background:
    * def db = Java.type('util.SqlConnection').getInstance()

The class not found located in src/test/java/util/SqlConnection.java and contains the following (this isn't the whole class, just what I think is relevant):

package util;

public class SqlConnection {

    private SqlConnection() {
    }

    public static synchronized SqlConnection getInstance() {
        ...
    }
}

This is the relevant part of my .classpath file:

<classpathentry including="**/*.java" kind="src" output="target/test-classes" path="src/test/java">
        <attributes>
            <attribute name="test" value="true"/>
            <attribute name="optional" value="true"/>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>

I'm new to both karate and Java, so please let me know if I've left out any information.

  • 1
    insufficient data. are you using the standalone JAR ? then you can't use custom java code without some work: https://stackoverflow.com/a/56458094/143475 - else I can only suggest that you follow this process: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue – Peter Thomas Jan 03 '20 at 15:39
  • Yes, I'm using the standalone JAR. Thank you for the link. – Road Runner Jan 03 '20 at 15:55

0 Answers0