如何在空手道功能中写几个范围名称?

How to write several scope names in karate feature?

空手道版本:0.6.0 Java版本:1.8 我已将范围名称(生成令牌所需)放在 json 文件中。

{"scopeFoo": "foo",
  "scopeBar": "bar",
  "scopeRead": "read",
  "scopeWrite": write}

我想要空手道功能

* def sc = read(scopes.json)    
* form field scope = "foo bar read write"

当我这样做时:

* def sc = read(scopes.json) 
* form field scope = sc.scopeFoo + sc.scopeBar + sc.scopeRead + sc.scopeWrite

没用。即使没有空格:

* form field scope = sc.scopeFoo+sc.scopeBar+sc.scopeRead+sc.scopeWrite

怎么了?谢谢 我可以在我的功能中访问 scopes.json 文件,因为在一个范围内它可以工作

如果您真的想将所有内容连接成一个字符串,请尝试用括号括起来。 Karate expressions:

的文档中对此进行了更多解释
form field scope = (sc.scopeFoo + sc.scopeBar + sc.scopeRead + sc.scopeWrite)