我对 Gatling 场景的实施有疑问。它在 Scala DSL 上,也许有人已经遇到过这个问题?
目标:我们需要在场景中注入数据。基本上,我们有 - 我们的页面http://ourPage.com/就像所有相对 URL 的根目录 - CSV 文件中的 URL 列表,这些 URL 基本上是来自我们的 Oracle 数据库的 650000 id,组合起来 (root+Urls)将模拟我们选择的用户数量。
如何在 Gatling 中从 CSV 文件中注入数据?
包括该文件存在于正确的目录(数据)中并且里面有正确的数据
希望我的信息可以理解,我将不胜感激任何帮助
Log:
18:42:54.456 [ERROR] i.g.c.ZincCompiler$ - C:\Users\nikol\OneDrive\Desktop\gatling-charts-highcharts-bundle-2.3.1\user-files\simulations\computerdatabase\BasicSimulation.scala:37: not found: value Article_ID
18:42:54.458 [ERROR] i.g.c.ZincCompiler$ - feed(csv(Article_ID.csv))
18:42:54.459 [ERROR] i.g.c.ZincCompiler$ - ^
18:42:54.584 [ERROR] i.g.c.ZincCompiler$ - C:\Users\nikol\OneDrive\Desktop\gatling-charts-highcharts-bundle-2.3.1\user-files\simulations\computerdatabase\BasicSimulation.scala:40: not found: value Article_ID
18:42:54.584 [ERROR] i.g.c.ZincCompiler$ - .get(s"${Article_ID}") // changet value from Article_ID.csv to Article_ID
18:42:54.584 [ERROR] i.g.c.ZincCompiler$ - ^
18:42:54.635 [ERROR] i.g.c.ZincCompiler$ - two errors found
18:42:54.639 [ERROR] i.g.c.ZincCompiler$ - Compilation crashed
package computerdatabase
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._
import io.gatling.jdbc.Predef._
class BasicSimulation extends Simulation {
val httpConf = http
.baseURL("http://my_link.com") // Here is the root for all relative URLs and this is example, this is not real link;
.acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") // Here are the common headers
.doNotTrackHeader("1")
.acceptLanguageHeader("en-US,en;q=0.5")
.acceptEncodingHeader("gzip, deflate")
.userAgentHeader("Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0")
val headers_10 = Map("Content-Type" -> "application/x-www-form-urlencoded") // Note the headers specific to a given request
val scn = scenario("Scenario Name") // A scenario is a chain of requests and pauses
feed(csv(Article_ID.csv))
.exec(http("Request")
.get(s"${Article_ID}") // changet value from Article_ID.csv to Article_ID
.pause(7))
setUp(scn.inject(atOnceUsers(1)).protocols(httpConf))
}