如何使用Maven通过空手道测试项目进行调试? [英] How to debug through a karate testing project using Maven?

查看:98
本文介绍了如何使用Maven通过空手道测试项目进行调试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以像我使用Maven调试Java应用程序一样通过测试进行调试? 例如,如果我在步骤的实现中设置断点,然后单击带有下一个CL参数的debug: mvn clean test -Dkarate.options="--tags ~@ignore" -Dtest=MainRunner -DforkCount=0

Is there a way I can debug through the test in a similar way that I would debug a Java app using Maven? For example, if I set breakpoint in the implementstion of step and click on debug with next parameters of CL: 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

我尝试接下来运行,并且正在运行:

I tried to run next and it's working:

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 Code扩展名/Karate Runner:

Just use the Visual Studio Code extension / Karate Runner: https://github.com/intuit/karate/wiki/IDE-Support#vs-code-karate-plugin

此处的视频: https://twitter.com/KarateDSL/status/1167533484560142336

这篇关于如何使用Maven通过空手道测试项目进行调试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆