karate.call在karate-config.js中找不到.feature文件 [英] karate.callSingle not found .feature file in karate-config.js

查看:46
本文介绍了karate.call在karate-config.js中找不到.feature文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用空手道v0.9.6,它是很棒的工具.我有一个> 1000场景,每个场景都需要令牌才能工作,因此我在karate-config.js中使用callSingle来创建和缓存令牌.我使用独立的jar文件.

I'm using karate v0.9.6, and it's wonderful tool. I have a >1000 scenarios, each of them need to token for work, so i use callSingle in karate-config.js for creating and caching tokens. I use standalone jar file.

我的karate-config.js的一部分:

Part of my karate-config.js:

  var auth_cfg = { 
  server: env,
  credentials: karate.properties['credentials']};

  var result = karate.callSingle('classpath:credentials/generate_tokens.feature', auth_cfg);

我正在使用.sh文件,如下所示:

I'm using .sh file like this:

rm -rf target &&
  java -Xmx2048m \
    -Dlogback.configurationFile=cfg/logs_debug.xml \
    -jar \
    -Dcredentials=data.json \
    karate-1.0.1.jar -e https://my-server/ \
    --tags ~fixme \
    --tags ~ignore \
    --threads 4 \
   features/services/simple_plan.feature

而且,很长时间以来,它在v.0.9.6上都能完美运行.但是,当我尝试升级到v 1.0或1.0.1时,出现错误:

And, it's working perfectly on v.0.9.6 long time. But, when I'm try to upgrade to v 1.0 or 1.0.1, a give an error:

org.graalvm.polyglot.PolyglotException: not found: credentials/generate_tokens.feature

我发现了此问题: https://github.com/intuit/karate/issues/1515

但是例子对我不起作用.我正在尝试使用"file:"和karate.properties ['karate.config.dir'] +'/features/auth/auth.feature'.总是我有一个错误:

But examples not working for me. I'm trying use "file:" and karate.properties['karate.config.dir'] + '/features/auth/auth.feature'. Always i got an error:

未找到:凭据/generate_tokens.feature

not found: credentials/generate_tokens.feature

还有谁遇到过这个问题?

Who else has faced this problem?

推荐答案

正如您在#1515的讨论中所看到的-这就是为什么我们真的希望更多的人尝试RC版本并给我们反馈(我们花了几个月),而不是等待1.0.

As you can see in the discussion of #1515 - this is why we'd really like more folks to try the RC versions and give us feedback (we spent months on this) instead of waiting for 1.0.

您似乎在使用独立JAR和自定义shell脚本的情况很严重.

Yours seems to be an edge case where you are using the stand-alone JAR and a custom shell script.

我的第一个建议是使用 -w 标志.这是1.0版中的新参数,可以设置当前工作目录",但在您的情况下应正确设置为默认值.

My first suggestion is to use the -w flag. This is a new argument in 1.0 which can set the "current working directory", but it should default correctly in your case.

第二个建议是设置JVM的类路径.使用它作为参考: https://stackoverflow.com/a/58398958/143475 -完成后, classpath:将按预期工作.

The second suggestion is to set the classpath for the JVM. Use this as a reference: https://stackoverflow.com/a/58398958/143475 - and once you do that, classpath: will work as you expect.

否则,请执行以下过程: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue -我不得不说,除非您能帮助我们解决此问题,否则您可能必须暂时停留在0.9.6上.抱歉.

Else please follow this process: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue - and I have to say that unless you can help us fix this, you may have to remain on 0.9.6 for a while. Sorry.

这篇关于karate.call在karate-config.js中找不到.feature文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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