1

Convert Json into CSV file and pass that ids in API parameter

  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')|

The response of attributeids is as below

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

is this possible with Karate API?

1 Answers1

0

You can get a CSV with karate.toCsv(): https://github.com/intuit/karate#karate-tocsv

After that writing it is your responsibility: https://stackoverflow.com/a/54593057/143475

Peter Thomas
  • 47,282
  • 14
  • 68
  • 196