本文介绍了如何在Karate框架中将变量传递到方案/方案标题的标题中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

例如

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.

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.

谢谢

学习.

推荐答案

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

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

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

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

这篇关于如何在Karate框架中将变量传递到方案/方案标题的标题中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 17:50