Hi All
I wrote a simple testing script on Gatling to test a web API. But an error 411 is on put process. It took me one week on finding a solution to fix this issue. But no topic related to this issue on internet was found. Please help me.
The below is the code
`
import scala.concurrent.duration._
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._
import io.gatling.http.request.builder.AbstractHttpRequestBuilder.toActionBuilder
import com.ning.http.client._
import com.ning.http.client.Realm.AuthScheme
import com.ning.http.client.Response
import com.ning.http.client.Realm
class RecordedSimulation extends Simulation {
val builder = new AsyncHttpClientConfig.Builder();
val realm = new Realm.RealmBuilder().setUsePreemptiveAuth(true)
.setPrincipal(“ouw”)
.setPassword(“Dede0415”)
.setNtlmDomain(“xxxxx.xxxx.xxx.nz”)
.setNtlmHost(“HWL61532D”)
.setScheme(AuthScheme.NTLM)
.build()
builder.setRealm(realm).build();
val httpProtocol = http
.baseURL(“http://whiteboard-test”)
.inferHtmlResources(BlackList("""..js""", “”"..css""", “”"..gif""", “”"..jpeg""", “”"..jpg""", “”"..ico""", “”"..woff""", “”"..(t|o)tf""", “”".*.png"""), WhiteList())
.acceptHeader(""“application/json, text/plain, /”"")
.acceptEncodingHeader(""“gzip, deflate”"")
.acceptLanguageHeader(""“en-US,en;q=0.5"”")
.authRealm(realm)
.connection(""“keep-alive”"")
.userAgentHeader(""“Mozilla/5.0 (Windows NT 6.1; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0"”")
val uri1 = “”“http://whiteboard-test/api”""
val headers_8 = Map(
“Accept” → “application/json, text/plain, /; q=0.01”,
“Referer” → “http://whiteboard-test/#/dosa/preop”)
val scn = scenario(“RecordedSimulation”)
.exec(http(“request_0”)
.get("/#/dosa/preop"))
.pause(9)
.exec(http(“Update”)
.put(uri1 + “”"/commonapi/putstatus?referenceNo=12798190&statusCode=ARR&stage=1&view=dosapreop""")
// .headers(headers_8)
)
setUp(scn.inject(atOnceUsers(1))).protocols(httpProtocol)
}
`
When running this script on Gatling an error (status.find.in(200,304,201,202,203,204,205,206,207,208,209), but actually found 411) always raises on “Update” stage. I have no idea where the code is wrong.
Please help me. Thank in Adv!!