【发布时间】:2016-04-07 16:14:50
【问题描述】:
加特林新手在这里。我正在尝试使用下面记录的 css 选择器检查我的页面的 html。该 css 项目出现在页面上(通过邮递员验证),但 Gatling 没有找到它。我在编译时收到一个变量未定义错误。任何建议将不胜感激。
import scala.concurrent.duration._
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._
class LoggingIn extends Simulation {
val httpProtocol = http
.baseURL("https://test.spidastudio.com")
.inferHtmlResources(BlackList(""".*\.js""", """.*\.css""", """.*\.gif""", """.*\.jpeg""", """.*\.jpg""", """.*\.ico""", """.*\.woff""", """.*\.(t|o)tf""", """.*\.png"""), WhiteList())
val headers_0 = Map(
"User-Agent"-> "Gatling",
"Accept" -> "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
"Accept-Encoding" -> "gzip, deflate",
"Cache-Control" -> "max-age=0",
"Origin" -> "https://test.spidastudio.com",
"Upgrade-Insecure-Requests" -> "1")
val headers_1 = Map("User-Agent"-> "Gatling","X-Requested-With" -> "XMLHttpRequest")
val uri1 = "https://test.spidastudio.com"
val scn = scenario("LoggingIn")
.exec(http("REQUEST A")
.post("/cas/login?service=https%3A%2F%2Ftest.spidastudio.com%2Fprojectmanager%2Fj_spring_cas_security_check")
//Defining variable LTValue
.check(css("input[name=lt]", "value").saveAs("LTValue"))
)
.exec(http("request_0")
.post("/cas/login?service=https%3A%2F%2Ftest.spidastudio.com%2Fprojectmanager%2Fj_spring_cas_security_check")
.headers(headers_0)
.formParam("username", "xxxxxxx.com")
.formParam("password", "xxxxxxxx")
//Calling variable
.formParam("lt", "${LTValue}")
【问题讨论】:
-
"我在编译时收到一个变量未定义错误" ...代码无法编译? “页面上存在 css 项目” - 这无关紧要 - 还是?编译错误怎么办?
标签: gatling