2
votes

I'm trying to design a load test for some APIs, I need to read the data from a CSV file, Here is my CSV file :

amount,description
100,"100 Added"
-150,"-150 removed"
20, "20 added"

the amount is a number.

My CSV data config looks like this: Image

When I put the body data like this : Image

I have this error :

{"timestamp":1529427563867,"status":400,"error":"Bad Request","message":"JSON parse error: Unrecognized token 'amount': was expecting ('true', 'false' or 'null'); nested exception is com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'amount': was expecting ('true', 'false' or 'null')\n 

and when I change it to this: Image

I have this error:

"timestamp":1529427739395,"status":400,"error":"Bad Request","message":"JSON parse error: Cannot deserialize value of type `java.math.BigDecimal` from String \"amount\": not a valid representation; nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type `java.math.BigDecimal` from String \"amount\": not a valid representation\n at [Source: (PushbackInputStream); line: 2, column: 13]

How should I pass the parameters to be able to read from the CSV file?

P.S it works fine when I do all the things without CSV.

1
You have "Ignore first line" set to False. You want it to be true...or remove the headers from the CSV source file.mjw
@mjw it worked! thank you!Hamid

1 Answers

2
votes

In your config, you have "Ignore first line" set to False.

Options:

1: Set "Ignore First Line" to True, for source files with header data included.

2: Leave the config setting as is, but remove the headers from the CSV source file.