【发布时间】:2018-11-28 17:21:36
【问题描述】:
我正在尝试为某些 API 设计负载测试,我需要从 CSV 文件中读取数据,这是我的 CSV 文件:
amount,description
100,"100 Added"
-150,"-150 removed"
20, "20 added"
金额是一个数字。
我的 CSV 数据配置如下所示: Image
当我这样放置身体数据时: Image
我有这个错误:
{"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
当我将其更改为: Image
我有这个错误:
"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]
我应该如何传递参数才能从 CSV 文件中读取?
P.S 当我在没有 CSV 的情况下做所有事情时它工作正常。
【问题讨论】:
-
您已将“忽略第一行”设置为 False。您希望它是真实的...或从 CSV 源文件中删除标题。
-
@mjw 成功了!谢谢!