Cucumber 将JSON转换为CSV并创建.CSV文件

Cucumber 将JSON转换为CSV并创建.CSV文件,cucumber,karate,Cucumber,Karate,将Json转换为CSV文件,并在API参数中传递该ID Scenario Outline: get Attribute ID's present in DB * def attributeids = db.readRows('SELECT PdmarticleattributeID FROM cs_pdmarticleattribute LIMIT 5') * print attributeids Given path 'admin/rest/product.json

将Json转换为CSV文件,并在API参数中传递该ID

  Scenario Outline: get Attribute ID's present in DB
    * def attributeids = db.readRows('SELECT PdmarticleattributeID FROM cs_pdmarticleattribute LIMIT 5')
    * print attributeids
    Given path 'admin/rest/product.json/attribute/'
    And path <PdmarticleattributeID>
    When method get
    Then status 200
    Examples: 
    |read('data/attributeids.csv')|

使用空手道API可以实现这一点吗?

您可以使用
Karate.toCsv()
获得CSV:


写完这篇文章后,您的责任是:

您可以使用
karate.toCsv()
获得CSV:

写完之后,您有责任:

[
  {
    "PdmarticleattributeID": 42180
  },
  {
    "PdmarticleattributeID": 42179
  },
  {
    "PdmarticleattributeID": 42178
  },
  {
    "PdmarticleattributeID": 42182
  },
  {
    "PdmarticleattributeID": 42181
  }
]