Karate 如何在空手道中部分匹配JSON密钥
我的回答是这样的Karate 如何在空手道中部分匹配JSON密钥,karate,Karate,我的回答是这样的 { "metadata": { "Customer_x0020_Folder": "Test" } } 我希望断言键Customer\u x0020\u文件夹等于“Test”。但是,我不关心它们键的x0020部分,我希望忽略该部分。我想做一些类似的事情: match response contains { metadata: {'Customer_' + '#ignore' + '_Folder': 'Test'} } 如何在空手道中执行此断言?使用Ka
{
"metadata": {
"Customer_x0020_Folder": "Test"
}
}
我希望断言键Customer\u x0020\u文件夹
等于“Test”。但是,我不关心它们键的x0020
部分,我希望忽略该部分。我想做一些类似的事情:
match response contains { metadata: {'Customer_' + '#ignore' + '_Folder': 'Test'} }
如何在空手道中执行此断言?使用Karate.keysOf()
:
使用空手道.keysOf():
* def response = { "metadata": { "Customer_x0020_Folder": "Test" } }
* def keys = karate.keysOf(response.metadata)
* match keys[0] == '#regex Customer_.*_Folder'