对于自动化,我需要添加无效案例。有效载荷是XML。我考虑过更新现有的XML有效负载元素文本,而不是为无效情况添加新的XML。
XML Example:
<?xml version="1.0" encoding="UTF-8"?>
<note>
<to>Tove</to>
<from>Jani</from>
<content>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</content>
</note>
[Documentation]
[Tags] API Regression POST
# Arrange
create session alias ${url}
${headers} create dictionary Content-Type=application/xml
${root} Parse xml ${xml_path}
# ${cCode} get element text ${root} ./content/heading
# log to console before update the value is "${cCode}"
${updated_xml} Set element text ${root} abc xpath=./content/heading
# ${cCode} get element text ${root} ./content/heading
# log to console after update the value is "${cCode}"
# Act
${resp}= Post Request alias resource_uri data="${updated_xml}" headers=${headers}
# Assert
Should Be Equal As Strings ${resp.status_code} 200
should contain ${resp.content} hasError="true" ```
Is this the way to do the scripting of updating element text.
Please guide me to make this working.