首先,我承认我是使用gatling的新手。当我使用Gatling测试我的场景时,我得到以下错误:
选择模拟ID(默认为'vertexperformance')。公认 字符是a-z,A-Z,0-9, - 和_ v7选择运行说明 (可选)测试线程“main”中的异常 java.lang.IllegalArgumentException:JSON馈送器文件的根元素 不是数组
请找到以下代码: ```
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._
import io.gatling.core.feeder._
class VertexPerformance extends Simulation {
val jsonFileFeeder = jsonFile("test.json")
val httpConf = http
.baseURL("https://rate.feeder")
.acceptHeader("application/xml, text/html, text/plain, application/json, */*")
.acceptCharsetHeader("UTF-8")
.acceptEncodingHeader("gzip, deflate")
val theCommonHeaders = Map(
"Accept" -> "application/xml, text/html, text/plain, application/json, */*",
"Accept-Encoding" -> "gzip, deflate")
val scn = scenario("Vertex API Test")
// .feed(Feeders.jsonFileFeeder)
.exec(
http("request_1")
.post("/tax_rates/v1/quotations")
.header(HttpHeaderNames.ContentType, HttpHeaderValues.ApplicationJson)
.header(HttpHeaderNames.Accept, HttpHeaderValues.ApplicationJson)
.body(RawFileBody("test.json"))
)
setUp(scn.inject(atOnceUsers(1)).protocols(httpConf))
}
``` 编辑:对于JSON,我使用的根元素不是数组。在那种情况下,我如何提供JSON?
请告知......