I want that user can input 'Count, repeatCount, testServerUrl and
definitionId' from command line while executing from Gatling. Can
anybody please help me? TIA.
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._
class TestCLI extends Simulation {
val count = 50
val wait = 2
val repeatCount = 2
val testServerUrl = "Some url"
val scn = scenario("testabcd")
.repeat (repeatCount ) {
exec(http("asdfg")
.post("""/xyzapi""")
.headers(headers_0)
.body(StringBody("""{"definitionId":10200121}"""))) // I also want to get this value dynamic from CLI and put here
.pause(wait)
}
setUp(scn.inject(atOnceUsers(count))).protocols(httpProtocol)
}
--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._
class TestCLI extends Simulation {
val count = Integer.getInteger("users", 50).toint
val wait = 2
val repeatCount = Integer.getInteger("repeatCount", 2).toInt
val testServerUrl = System.getProperty("testServerUrl")
val definitionId = java.lang.Long.getLong("definitionId", 0L)
val httpProtocol = http
.baseURL(testServerUrl)
.inferHtmlResources()
.acceptHeader("""*/*""")
.acceptEncodingHeader("""gzip, deflate""")
.acceptLanguageHeader("""en-US,en;q=0.8""")
.authorizationHeader(envAuthenticationHeaderFromPostman)
.connection("""keep-alive""")
.contentTypeHeader("""application/vnd+json""")
.userAgentHeader("""Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.65 Safari/537.36""")
val headers_0 = Map(
"""Cache-Control""" -> """no-cache""",
"""Origin""" -> """chrome-extension://mmmmmmmmmmmm""")
val scn = scenario("testabcd")
.repeat (repeatCount ) {
exec(http("asdfg")
.post("""/xyzapi""")
.headers(headers_0)
.body(StringBody("""{"definitionId":$definitionId}"""))) // I also want to get this value dynamic from CLI and put here
.pause(wait)
}
setUp(scn.inject(atOnceUsers(count))).protocols(httpProtocol)
}
But gives this error while running,D:\abc\gatling-charts-highcharts-bundle-2.1.7\bin>JAVA_OPTS="-DuserCount=50 -D flowRepeatCount=2 -DdefinitionId=10220301 -DtestServerUrl='something'"
gatling.b at 'JAVA_OPTS' is not recognized as an internal or external command, operable program or batch file.
D:\Ronak\gatling-charts-highcharts-bundle-2.1.7\bin>java JAVA_OPTS="-DuserCount=
50 -DflowRepeatCount=2 -DdefinitionId=10220301 -DtestServerUrl='something'" ./ga
tling.bat
Error: Could not find or load main class JAVA_OPTS=-DuserCount=50 -DflowRepeatCo
unt=2 -DdefinitionId=10220301 -DtestServerUrl='something'