将空值与表关键字一起传递在空手道中不起作用。这是否只能通过添加场景大纲来实现!到列标题?

问题描述 投票:0回答:1
Feature: table keyword demo data driven testing feature

  Scenario: table keyword demo data driven testing scenario
    * table users
      | name    | job    |
      | null    | null   |
    * call read('@user') users

  @ignore @user
  Scenario: create a new user
    Given url 'https://reqres.in/api/users'
    Given request {"name": '#(name)',"job": '#(job)'}
    When method post
    Then status 201
    Then match $ == {name: '#(name)',job: '#(job)',id: #notnull,createdAt: #notnull}

我只是检查负面数据驱动测试场景是否也可以像场景大纲和示例那样用空手道中的表关键字覆盖

karate
1个回答
0
投票

如果您确实想要该列,但将值

null
括在圆括号中,则将
null
括起来。文档中提到了这一点:https://github.com/karatelabs/karate#table

* table users
  | name    | job    |
  | (null)  | (null) |
© www.soinside.com 2019 - 2024. All rights reserved.