1

My csv file data : 1 column is HeaderText(6 rows) and other is accountBtn(4 rows)

accountBtn,HeaderText
New Case,Type
New Note,Phone
New Contact,Website
,Account Owner
,Account Site
,Industry

When I'm reading file with below code

* def csvData = read('../TestData/Button.csv')
* def expectedButton = karate.jsonPath(csvData,"$..accountBtn")
* def eHeaderTest = karate.jsonPath(csvData,"$..HeaderText")

data set generated as per code is : ["New Case","New Note","New Contact","","",""]

My expected data set is : ["New Case","New Note","New Contact"]

Any idea how can this be handled?

QaExpert
  • 43
  • 5

1 Answers1

0

That's how it is in Karate and it shouldn't be a concern since you are just using it as data to drive a test. You can run a transform to convert empty strings to null if required: https://stackoverflow.com/a/56581365/143475

Else please consider contributing code to make Karate better !

The other option is to use JSON as a data-source instead of CSV: https://stackoverflow.com/a/47272108/143475

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