空手道 - callonce 功能不缓存响应
Karate - callonce feature doesn't cache the response
我有两个特征文件,我正在尝试重复使用第一个特征文件的结果作为第二个特征文件场景的背景
专题文件 1
Feature: First feature file
Scenario: create random session id
* def sessionId = Java.type('com.company.RandomSessionId').getRandomSessionId()
专题文件 2
特征:调用另一个特征文件
背景:
* def mycall = callonce read('first.feature')
* def randomId = mycall.sessionId</p>
<p>场景:打印sessionId
* 打印随机ID
场景:打印sessionId-2
* 打印随机ID
当我执行功能文件 2 中的场景时,我得到了两个不同的结果。
一定是因为你使用了IDE支持/右键/"run-as"选项。这是一个悬而未决的问题,因为 Karate 需要缓存 "native" Cucumber 不支持的场景:https://github.com/intuit/karate/issues/136 - 抱歉,我需要更新文档。
请在这些情况下使用 JUnit 运行器,无论如何我建议在开发模式下使用这些运行器,新的 HTML 开发模式报告使它更有用:https://twitter.com/KarateDSL/status/935029435140489216
我有两个特征文件,我正在尝试重复使用第一个特征文件的结果作为第二个特征文件场景的背景
专题文件 1
Feature: First feature file
Scenario: create random session id
* def sessionId = Java.type('com.company.RandomSessionId').getRandomSessionId()
专题文件 2
特征:调用另一个特征文件
背景:
* def mycall = callonce read('first.feature')
* def randomId = mycall.sessionId</p>
<p>场景:打印sessionId
* 打印随机ID
场景:打印sessionId-2
* 打印随机ID
当我执行功能文件 2 中的场景时,我得到了两个不同的结果。
一定是因为你使用了IDE支持/右键/"run-as"选项。这是一个悬而未决的问题,因为 Karate 需要缓存 "native" Cucumber 不支持的场景:https://github.com/intuit/karate/issues/136 - 抱歉,我需要更新文档。
请在这些情况下使用 JUnit 运行器,无论如何我建议在开发模式下使用这些运行器,新的 HTML 开发模式报告使它更有用:https://twitter.com/KarateDSL/status/935029435140489216