2017-09-30 73 views
1

空手道版本: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文件,因爲在一個範圍內工作

回答

1

如果您確實想要將所有內容連接成單個字符串,請嘗試使用括號括起來。這在Karate expressions的文檔中有更詳細的解釋:

form field scope = (sc.scopeFoo + sc.scopeBar + sc.scopeRead + sc.scopeWrite)