如何在Karate框架中将变量传递到方案/方案标题的标题中

时间:2018-10-09 08:45:56

标签: karate

虽然在Karate框架中使用数据驱动功能,但我看到生成的报告仅显示了方案大纲中配置的标题,而没有在Example表中使用该值。这会导致测试人员混淆正在使用哪些数据,并花一些时间来扩展每个方案以了解正在使用的数据。所以我希望报告可以将变量传递到标题-方案/方案大纲。请看下面的例子。

例如

Feature: Login Feature


  Background:
    * configure headers = { 'Webapp-Version': '1.0.0'}

  Scenario Outline:   As a <description> user, I want to get the corresponding response_code <status_code>
      Given def path = 'classpath:features/Authentication/authentication.feature'
      And def signIn = call read(path) {username: '<username>', password: '1234567890'}
      Then match signIn.status == <status_code>


      Examples:
           |username       | status_code| description |
           |test@gmail.com | 200        | valid user  |
           |null           | 400        | invalid user|

我的预期结果是,生成的报告应该填充表中“状态代码”和“描述”字段的值。 ->作为有效的用户,我想获得相应的response_code 200。

请分享您的想法和评论。

谢谢

学习。

1 个答案:

答案 0 :(得分:0)

不支持。只需使用print语法,您就会在报告中看到它。

编辑:好的,这将在下一版本中实现:https://github.com/intuit/karate/issues/553