我在CSV中有数据并将其加载到我的场景中。但是,最后一列中的值将使用尾随空格进行解析。 (实际上,hexdump将其显示为字节e2 80 0a
(unix模式)或e2 80 a8
(dos模式)。
CSV(简化)
speed,course
19.92,248.203125
模拟
val conf = http
.baseURL("http://myapp")
.acceptHeader("image/png,image/*;q=0.8,*/*;q=0.5")
.acceptEncodingHeader("gzip, deflate")
.acceptLanguageHeader("en-US,en;q=0.5")
.connectionHeader("keep-alive")
.userAgentHeader("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36")
val requestsDS = csv("src/test/resources/mixed-route-load.csv").circular
val scn = scenario("mixed route load")
.feed(requestsDS)
.exec {
http("Load route")
.get(s"/endpoint?course=${course}&speed=${speed}")
}
setUp(scn.inject(
atOnceUsers(5),
rampUsers(20).over(Duration(30, "s"))
).protocols(conf))
结果:
=========================
HTTP request:
GET http://myapp/endpoint?course=173.125183%E2%80%A8
headers=
Connection: keep-alive
Accept: image/png,image/*;q=0.8,*/*;q=0.5
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36
Host: myapp
=========================
HTTP response:
status=
400 Bad Request
headers=
Server: nginx/1.8.1
Date: Mon, 27 Jun 2016 04:55:59 GMT
Content-Type: text/plain; charset=UTF-8
Content-Length: 95
Connection: keep-alive
body=
The query parameter 'course' was malformed:
'173.125183
' is not a valid floating point value
<<<<<<<<<<<<<<<<<<<<<<<<<
答案 0 :(得分:0)
错误已在输入文件本身中编码。可能是从OSX电子表格应用程序编号导出的工件。加特林正在准确地转换它。