Karate 替换空手道中data.xml文件中的标记值 1.从要素文件读取data.xml文件。 2.将标记值替换为随机值-**首先,我尝试用硬编码值替换,但没有更改** 3.选择POST方法并获得响应 下面提到data.xml和Test.feature文件片段- **1.data.xml** 87abc65 食物 **2.Test.feature** 在下面的代码中解释了替换-
场景:获取输出Karate 替换空手道中data.xml文件中的标记值 1.从要素文件读取data.xml文件。 2.将标记值替换为随机值-**首先,我尝试用硬编码值替换,但没有更改** 3.选择POST方法并获得响应 下面提到data.xml和Test.feature文件片段- **1.data.xml** 87abc65 食物 **2.Test.feature** 在下面的代码中解释了替换-,karate,Karate,场景:获取输出 def req=read('data.xml') 替换请求 |令牌|值| |@@UID@@@12345”| xml req=req 和请求请求请求 当方法发布时 那么状态200可能设置更好: 1.Read the data.xml file from feature file. 2.Replace tag value <UID> to random values - **First I have tried to replace
- def req=read('data.xml')
- 替换请求
- xml req=req
那么状态200可能
设置
更好:
1.Read the data.xml file from feature file.
2.Replace tag value <UID> to random values - **First I have tried to replace with a hard-coded value,but no changes**
3.Go for POST method and get the response
data.xml and Test.feature file snippet is mentioned below -
**1.data.xml**
<Test>
<First>
<UID>87abc65</UID>
<Second>Food</Second>
</First>
</Test>
**2.Test.feature**
Explained the replace in below code -
否则你就不明白了。请仔细阅读以下文件:
* set req/Test/First/UID = '12345'