How to pass variable into the title of a scenario/scenario title in Karate framework

帅比萌擦擦* 提交于 2019-12-24 11:57:20

问题


While using data-driven feature in Karate framework, I see the generated report just show the title as configured in Scenario Outline NOT attached the value using in Example table. It causes the Tester confuse which data is using, and take time to expand each scenarios to know which data is using; so I want the report can pass variable into the title - Scenario/Scenario Outline. Please take a look at the example below.

E.g.

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|

My expected result, the generated report should fill the value on table for field "status code" and "description" fields. -> As a valid user user, I want to get the corresponding response_code 200.

Please share your ideas and comments on it.

Thanks,

Learn.


回答1:


Not supported. Just use the print syntax and you will see it in the report.

EDIT: okay this will be possible in the next version: https://github.com/intuit/karate/issues/553



来源:https://stackoverflow.com/questions/52716858/how-to-pass-variable-into-the-title-of-a-scenario-scenario-title-in-karate-frame

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!