Gatling error failed status.find.is(200), but actually status 401

Hi

I read many articles found in internet and try to find a solution to fix it. But it didn’t work.

Here is my code:
package computerdatabase

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 WhiteBoardDosa extends Simulation {

object Viewer {
var viewer = exec(http(“Home”)
.get("/")
.check(status.is(200)))
.pause(1)
.exec(http(“PreOp”)
.get("/#/dosa/preop")
.check(status.is(200)))
.pause(6)
.exec(http(“PostOp”)
.get("/#/dosa/postop")
.check(status.is(200)))
.pause(6)
.exec(http(“Theatre Booking Barometer”)
.get(""“http://tdcvts009:84/”"")
.check(status.is(200)))

}

object Administration {
val jsonFileFeeder = jsonFile(“adminSimulation_request_location_edit.json”).random
val headers_1 = Map(“Content-Type” → “application/json”)

var admin = exec(http(“Home”)
.get("/")
.check(status.is(200)))
.pause(1)
.exec(http(“Administration”)
.get("/#/administration")
.check(status.is(200)))
.pause(2)
.feed(jsonFileFeeder)
.exec(http(“Edit Location”)
.put("""/api/adminapi/puttheatrelocation?code=CATHLABCCL1""")
.headers(headers_1)
.body(StringBody("${TheatreSuite}"))
.asJSON
.check(status.is(200)))
// .body(RawFileBody(“adminSimulation_request_location_edit.txt”)))
}

val builder = new AsyncHttpClientConfig.Builder();

val realm = new Realm.RealmBuilder().setUsePreemptiveAuth(true)
.setPrincipal(“ouw”)
.setPassword(“XXXXX”)
.setNtlmDomain(“WAIKATO”)
.setNtlmHost(“whiteboard-test”)
.setScheme(AuthScheme.NTLM)
.build()

builder.setRealm(realm).build();

val httpProtocol = http
.baseURL(“http://whiteboard-test”)
.inferHtmlResources()
.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"”")

var users = scenario(“Users”).exec(Viewer.viewer)
var admins = scenario(“Admins”).exec(Viewer.viewer, Administration.admin)

setUp(
users.inject(constantUsersPerSec(40) during(25 seconds) randomized),
admins.inject(constantUsersPerSec(10) during(25 seconds) randomized)

).protocols(httpProtocol)
}

what I do not understand is what setNtlmDomain and setNtlmHost are and how config them correctly.

Thank you adv.

Hi,

First, NTLM support just got fixed. We’ll be releasing the version with the fix on monday.
Then, there’s now a DSL for NTLM: http://gatling.io/docs/2.0.0/http/http_protocol.html#authentication. Note that the version without ntlm domain and host is going away, those are mandatory.

Finally, NTLM domain and host are usually displayed when you log on your computer: domain is the AD zone you belong and host is the name of your workstation.

Cheers,

Stéphane