Gatling Get web service

1.5k Views Asked by At

I have tried to create a simple Gatling Script mentioned below,

package computerdatabase.advanced

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._
import scala.util.matching.Regex
import scala.concurrent.duration._



class getSampleTest extends Simulation{

val httpProtocol = http
.baseURL("https://xyz.com")
.header("Content-Type","application/json")
.header("Accept"," application/json ")
.header("Accept-Charset","utf-8n")
.acceptLanguageHeader("en-us","en;q=0.5")
.acceptEncodingHeader("gzip", "deflate")
.connection("keep-alive")


val scn = scenario("XYZ")
.group("XYZ Group") {
exec(http("XYZ-PAge").get("/profile/services").check(status.is(200)))
}
setUp(scn.inject(
rampUsersPerSec(1) to(10) during(5), 
constantUsersPerSec(10) during(5)
).protocols(httpProtocol))

}

but i am getting an error saying that --> value header is not a member of io.gatling.http.config.httpProtocolBuilder may be a semicolon is missing before'value header' .header("Content-Type","application/json")

1

There are 1 best solutions below

3
On

No, this is not the compiler error message you get with such code (this is the error you got with the first tentative you posted on the Gatling mailing list).

Here, you get "too many arguments for method acceptLanguageHeader" (and acceptEncodingHeader) as those take only one parameter:

.acceptLanguageHeader("en-us, en;q=0.5")
.acceptEncodingHeader("gzip, deflate")