Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

nametypedefaultalternative option names
with-headerbooleantruewithheader
quote-charcharacter\"quotechar
delimitercharacter, 
end-of-line-symbolsstring\r\nendoflinesymbols, end-of-line, eol-symbols

CSV without headers

When you pass the csv-config option 'with-header' with value 'false', the request will assume that the csv does not contain headers. It will then use a zero-based index as header.

Examples:

Code Block
titleExample of csv options
  Scenario Outline: Combine different options
    Given i call get "/rest/csv?withHeader=true&endOfLineSymbols=<eol>&delimiter=<delimiter>&quoteChar=<quoteChar>" with parameters:
      | name         | value       | type       |
      | content-type | text/csv    | header     |
      | end-of-line  | <eol>       | csv-config |
      | delimiter    | <delimiter> | csv-config |
      | quoteChar    | <quoteChar> | csv-config |
    Then the response status should be 200
    And the response entity "csv[1]" should contain "firstName" with value "John"
  Examples:
    | eol  | delimiter | quoteChar |
    | \r\n | ;         | '         |
    | \n   | \|        | #         |
Code Block
titleExample of CSV without headers
  Scenario: Support line index for csv without headers
    Given i call get "/rest/csv?withHeader=false" with parameters:
      | name         | value    | type       |
      | content-type | text/csv | header     |
      | with-header  | false    | csv-config |
    Then the response status should be 200
	# csv[0]: check the first row of the response
	# should contain "1": check the value of the second column in the row
    And the response entity "csv[0]" should contain "1" with value "John"
    And the response entity "csv[1]" should contain "1" with value "Bob"