有没有一种方法可以像我使用Maven调试Java应用程序一样通过测试进行调试?例如,如果我在步骤的实现中设置断点,然后单击带有下一个CL参数的debug:mvn clean test -Dkarate.options="--tags ~@ignore" -Dtest=MainRunner -DforkCount=0
并且我遇到下一个错误:
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ karateSberApi ---
[WARNING] useSystemClassloader setting has no effect when not forking
[INFO] Running examples.MainRunner
before all
get credentialsMap by cmd
19:27:39.169 [main] INFO com.intuit.karate.RunnerOptions - found system property 'karate.options': --tags ~@ignore
after all
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.875 s <<< FAILURE! - in examples.MainRunner
[ERROR] testAll Time elapsed: 0.872 s <<< ERROR!
java.lang.NoClassDefFoundError: jdk/nashorn/api/scripting/ScriptObjectMirror
Caused by: java.lang.ClassNotFoundException: jdk.nashorn.api.scripting.ScriptObjectMirror
我试图接下来运行,并且正在运行:
public static void main(String[] args) throws ScriptException {
ScriptEngine engine = new ScriptEngineManager().getEngineByName("nashorn");
engine.eval("print('Hello World!');");
}
怎么了?env:
Intellij Idea 2019.3
Bundled (Maven 3) version 3.6.1
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
感谢您的回答!
只需使用Visual Studio代码扩展/空手道赛跑者:https://github.com/intuit/karate/wiki/IDE-Support#vs-code-karate-plugin
此处视频:https://twitter.com/KarateDSL/status/1167533484560142336