-1

The scenarios work if I create individual ones for each permutation however I would like to avoid having to read the file multiple times considering it can become quite a large file.

  Scenario Outline: Mass_A is correct for STD and PCE
    * def row =
    """
    {

    Artikeltyp: '<Artikeltyp>',
    MinBestellmengeEinheit: '<MinBestellmengeEinheit>',
    Mass_A: '<Mass_A>'
    }
    """
    * def tempArtikeltyp = '<Artikeltyp>'
    * def tempMinBestellmengeEinheit = '<MinBestellmengeEinheit>'
    * def tempMass_A = '<Mass_A>'
    * def listMinBestTypes = ['PCE','PR','DZN']

    * def expected = (tempArtikeltyp == 'STD'  && (karate.match(listMinBestTypes,tempMinBestellmengeEinheit).pass) && (tempMass_A.length <= 0)) ? 'Mass_A is NOT populated for STD and PCE' : 'Mass_A is correct for STD and PCE'
    * match expected == karate.info.scenarioName

    Examples:
      | read('input.csv')|

Any guidance would be much appreciated.

  • I'm skipping this question as I don't understand it. also, you seem to be focused on using a CSV without understanding the basics of JSON or Karate. if you re-ask the question with what you want to do - it is quite likely that it can be done without using a `Scenario Outline`. all the best – Peter Thomas Jul 08 '21 at 09:30

1 Answers1

1

Here is a suggestion. Please re-think your entire approach. Start with the CSV file, convert it to JSON and then run all the permutations or combinations you want. Example below:

Scenario:
* def isValid = function(x){ return true }
* def data = read('input.csv')
* match each data == '#? isValid(_)'
Peter Thomas
  • 54,465
  • 21
  • 84
  • 248