当我尝试自动化 API 测试过程时,必须将 XML 文件传递给 Read 方法,例如,
Given request read ( varXmlFile )
仅供引用:XML 文件与功能文件位于同一文件夹中。
这样做,会抛出这样的异常
com.intuit.karate.exception.KarateException: called: D:\workspace\APIAutomationDemo\target\test-classes\com\org\features\rci_api_testing.feature, scenario: Get Membership Details, line: 15
javascript evaluation failed: read (varXmlFile )
那么 Karate 不允许这种方式,或者我们可以有其他选择吗?
请提出建议。
谢谢
最佳答案
请确保设置了变量:
* def varXmlFile = 'some-xml-file.xml'
Given request read(varXmlFile)
或者正常使用:
Given request read('some-xml-file.xml')
关于java - 我们可以将请求文件名参数化到Karate中的Read方法吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48377684/