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

查看:43
本文介绍了在 karate-config.js 中找不到 karate.callSingle .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

但是示例对我不起作用.我正在尝试使用文件:"和 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-config.js 中找不到 karate.callSingle .feature 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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