-1

#noinspection CucumberTableInspection
Feature: Serverless

  Background:
    * def data = read('input.csv')
    * csv data = data
    * def isValid = function(x){ return (x.name && x.unit) ? x.cost.length != 0 : true }

  Scenario Outline:
    * assert isValid(__row)

    Examples:
      | data |

The test runs but doesn't check anything.

Karate version: 1.1.0.RC4

elapsed: 1,77 | threads: 1 | thread time: 0,00 features: 0 | skipped: 1 | efficiency: 0,00 scenarios: 0 | passed: 0 | failed: 0

HTML report: (paste into browser to view) | Karate version: 1.1.0.RC4

===================================================================

Process finished with exit code 0

  • Thanks for the comment. Unfortunately this is the scenario we are dealing with at a customer and not something we have chosen ourselves. – Stephanie H Jul 07 '21 at 07:17

1 Answers1

0

The * csv data = data is not needed and was used to explain something totally different earlier. When "read" a CSV becomes a JSON array automatically: https://github.com/intuit/karate#csv-files

If you are new to Karate I recommend you don't use CSV files and the Scenario Outline. Please just get used to Examples first and then move on from there. You are combining 3 advanced topics - CSV, dynamic outlines and conditional assertions. Do your tests really need to be so clever and complex ? Read this please: https://stackoverflow.com/a/54126724/143475

And please please read the docs and the examples: https://github.com/intuit/karate#dynamic-scenario-outline

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248