def userName ='ABC'
def input json = {
"integration": {
"serviceData": {
"integrationService": {
"name": "fld_<tenantID>_stage00.integrations:<integrationName>"
},
"gitComments": "Commit made by: ABC"
}
}
}
在上面的json中,我需要参数化用户名'ABC'
如果我发送 “ gitComments”:“#(用户名)”
正在检查'ABC'很好 但是我需要在字符串“ Commit made by:”之前加上前缀,然后在输入的json中添加#(userName)。
预先感谢
答案 0 :(得分:2)
我想您永远不会阅读文档。正确:) https://github.com/intuit/karate#rules-for-embedded-expressions
* def gitComments = 'Commit made by: ' + userName
* def json = { gitComments: '#(gitComments)' }