空手道 - 编辑 xml 而 运行 测试用例
Karate - editing xml while running the test case
我有以下 xml:
<?xml version="1.0" encoding="utf-8"?>
<request>
<head>
<session-id>none</session-id>
</head>
<service name="test">
<function name="testFunc">
<guids>
<guid>#guid#</guid>
<guid>#guid#</guid>
</guids>
</function>
</service>
</request>
我有 2 个测试用例:
- 我想用单个 guid 进行测试。
- 我想用 2 个 guid 进行测试。
我为两个测试用例创建了 2 个单独的 xml,并且它有效。
这里的问题是我如何使用普通的 xml?
我也尝试使用 remove 但如何从 xml?
中删除单个 guid
空手道中有一种叫做“嵌入表达式”的东西。阅读文档:https://github.com/intuit/karate#embedded-expressions
示例:
* def guids = <guids><guid>one</guid><guid>two</guid></guids>
* def body = <root>#(guids)</root>
另请参阅此文件,它有很多其他示例和想法用于 XML data-driven 测试:xml.feature
.
我有以下 xml:
<?xml version="1.0" encoding="utf-8"?>
<request>
<head>
<session-id>none</session-id>
</head>
<service name="test">
<function name="testFunc">
<guids>
<guid>#guid#</guid>
<guid>#guid#</guid>
</guids>
</function>
</service>
</request>
我有 2 个测试用例:
- 我想用单个 guid 进行测试。
- 我想用 2 个 guid 进行测试。
我为两个测试用例创建了 2 个单独的 xml,并且它有效。 这里的问题是我如何使用普通的 xml? 我也尝试使用 remove 但如何从 xml?
中删除单个 guid空手道中有一种叫做“嵌入表达式”的东西。阅读文档:https://github.com/intuit/karate#embedded-expressions
示例:
* def guids = <guids><guid>one</guid><guid>two</guid></guids>
* def body = <root>#(guids)</root>
另请参阅此文件,它有很多其他示例和想法用于 XML data-driven 测试:xml.feature
.