我正在使用Gatling工具加载测试我的网站有谷歌地图,当我从Gatling记录测试用例时,我得到上述错误,但当我浏览网站没有Gatling它工作正常。请协助。
代码:
val httpProtocol = http
.baseURL("http://staging.user.com")
.inferHtmlResources()
val headers_0 = Map("Accept" -> "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
val headers_1 = Map("Accept" -> "text/css,*/*;q=0.1")
val headers_2 = Map("Accept" -> "*/*")
val headers_19 = Map(
"Accept" -> "application/json, text/javascript, */*; q=0.01",
"X-Requested-With" -> "XMLHttpRequest")
val uri1 = "static.hotjar.com"
val uri2 = "http://www.google-analytics.com"
val uri3 = "http://staging.user.com/user"
val uri4 = "www.googletagmanager.com"
val scn = scenario("RecordedSimulation")
.exec(http("request_0")
.get("/user/sulogin.html")
.headers(headers_0)
.resources(http("request_1")
.get(uri3 + "/resources-Andromeda.1742/css/login.css")
.headers(headers_1)
.check(status.is(304)),
http("request_2")
.get(uri3 + "/resources-Andromeda.1742/js/analytics/google_tag_manager.js")
.headers(headers_2),
http("request_3")
.get(uri3 + "/resources-Andromeda.1742/js/login/loginHandler.js")
.headers(headers_2),
http("request_4")
.get(uri3 + "/resources-Andromeda.1742/images/sidebar_login_top.png")
.check(status.is(304)),
http("request_5")
.get(uri3 + "/resources-Andromeda.1742/js/libraries/jquery/jquery.validate-1.13.1.min.js")
.headers(headers_2),
http("request_6")
.get(uri3 + "/resources-Andromeda.1742/images/user_fleet_logo.png")
.check(status.is(304)),
http("request_7")
.get(uri3 + "/resources-Andromeda.1742/images/sidebar_login_bottom.png")
.check(status.is(304)),
http("request_8")
.get(uri3 + "/images/breadcrumb_top.png")
.check(status.is(304)),
http("request_9")
.get(uri3 + "/images/bg_login.png")
.check(status.is(304)),
http("request_10")
.get(uri3 + "/resources-Andromeda.1742/js/libraries/jquery/jquery-1.8.3.min.js")
.headers(headers_2)))
.pause(5)
.exec(http("request_11")
.get("http://" + uri4 + "/gtm.js?id=GTM-KW4P7K")
.headers(headers_2)
.resources(http("request_12")
.get(uri2 + "/analytics.js")
.headers(headers_2)
.check(status.is(304)),
http("request_13")
.get(uri2 + "/collect?v=1&_v=j41&a=2011589431&t=pageview&_s=1&dl=http%3A%2F%2Fstaging.user.com%2Fuser%2Fsulogin.html&ul=en-us&de=windows-1252&dt=user%20Customer%20Login&sd=24-bit&sr=1366x768&vp=1366x659&je=0&fl=21.0%20r0&_u=QAEAAAABI~&jid=&cid=44054207.1439273009&tid=UA-40333098-1>m=GTM-KW4P7K&z=2099200825")))
.pause(1)
.exec(http("request_14")
.post("/user/j_spring_security_check?back_url=")
.headers(headers_0)
.formParam("targetCustomer", "***")
.formParam("j_username", "****")
.formParam("j_password", "****")
.formParam("LOGIN", "LOGIN")
.resources(http("request_15")
.get(uri3 + "/custom/css/get?time=1459314853496")
.headers(headers_1),
http("request_16")
.get("http://" + uri1 + "/c/hotjar-137185.js?sv=5")
.headers(headers_2)
.check(status.is(304)),
http("request_17")
.get(uri3 + "/custom/logo.png?version=1459314853497")))
.pause(3)
.exec(http("request_18")
.get(uri2 + "/collect?v=1&_v=j41&a=254846444&t=pageview&_s=1&dl=http%3A%2F%2Fstaging.user.com%2Fuser%2Fmap.html%3Fl%3Den_US&ul=en-us&de=windows-1252&dt=user&sd=24-bit&sr=1366x768&vp=1366x659&je=0&fl=21.0%20r0&_u=QAEAAAABI~&jid=&cid=44054207.1439273009&tid=UA-40333098-1>m=GTM-KW4P7K&z=1352870067")
.resources(http("request_19")
.post(uri3 + "/getUserUnitPref.json")
.headers(headers_19),
http("request_20")
.get(uri3 + "/getUserPrivileges.json?_=1459314859620")
.headers(headers_19)))
setUp(scn.inject(atOnceUsers(1))).protocols(httpProtocol)
}