Hi
I’m working on a POC, and researching few performance/load testing frameworks.
I gave Gatling a try, I started with using gatling.sh, and it all was working fine, requests were going out, reports were generating.
Then, in order to check how can I incorporate gatling tests into CI environment (not jenkins).
I created sbt project in IntelliJ (no scala or sbt installed on machine) based on sbt-plugin-demo, and it used to work.
Today I came back to office, wanted to make some cleanup in git, and add few steps to scenario I was working on.
And all of a sudden I started getting below error when running gatling:test
[error] Uncaught exception when running tests: java.lang.NoSuchMethodError: scala.Predef$.refArrayOps([Ljava/lang/Object;)Lscala/collection/mutable/ArrayOps;
[trace] Stack trace suppressed: run last gatling:test for the full output.
[info] Simulation(s) execution ended.
[error] Error during tests:
[error] Forked test harness failed: java.io.EOFException
[error] at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2608)
[error] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1319)
[error] at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
[error] at sbt.React.react(ForkTests.scala:122)
[error] at sbt.ForkTests$$anonfun$mainTestTask$1$Acceptor$2$.run(ForkTests.scala:76)
[error] at java.lang.Thread.run(Thread.java:745)
[error] (gatling:test) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 6 s, completed Jun 28, 2017 12:16:21 PM
`
build.sbt
name := "gatling"
version := "1.0"
scalaVersion in ThisBuild:= "2.12.2"
enablePlugins(GatlingPlugin)
scalacOptions := Seq(
"-encoding", "UTF-8", "-target:jvm-1.8", "-deprecation",
"-feature", "-unchecked", "-language:implicitConversions", "-language:postfixOps")
libraryDependencies += "io.gatling.highcharts" % "gatling-charts-highcharts" % "2.2.5" % "test,it"
libraryDependencies += "io.gatling" % "gatling-test-framework" % "2.2.5" % "test,it"
`
plugins.sbt
`addSbtPlugin("io.gatling" % "gatling-sbt" % "2.2.1")
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "3.0.0")
`
my scenario:
import io.gatling.core.Predef._
import io.gatling.http.Predef._
class Login_QA extends Simulation {
val httpConf = http
.baseURL("XXX")
.inferHtmlResources()
val scn = scenario("Login")
.exec(flushSessionCookies)
.exec(http("getLogin")
.get("XXX").check(status.is(_ => 200)))
.exec(http("postLogin")
.post("XXX")
.formParam("a", "YY")
.formParam("b", "YY")
.check(status.is(_ => 200),
header("X-AJAX-LOCATION").saveAs("auth")))
.exec(http("getAuth")
.get("${auth}")
.check(status.is(_ => 200),
currentLocationRegex("XXXX")))
.exec(http("GET from REST")
.get("/").disableFollowRedirect
.resources(
http("getProfile").get("/rest/profile/").check(jsonPath("$.firstName").exists),
http("a").get("/rest/a"),
http("b").get("/rest/b"),
http("c").get("/rest/c"),
http("d").get("/rest/d"),
http("e").get("/rest/e"),
http("f").get("/rest/f"),
http("g").get("/rest/g"),
http("g").get("/rest/h")
)
)
setUp(
scn.inject(atOnceUsers(1)).protocols(httpConf)
).assertions(
global.responseTime.percentile1.lt(300)
)
}
`