Hi All,
This is something which I have been having issues with for a while now, but I thought it’s best to ask the community.
Without going into too much detail, I am testing an ASP.NET solution with scenario that does two things, Firstly, logs a user in and then navigates to a members only area and performs another action.
`
val httpConfig = HttpConfiguration.httpConfig
val userdetails = csv(“userdetails.csv”).random
val headers_0 = Map(""“Accept”"" → “”“text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8"”")
val enter = scenario(“Enter Test”).group(“post Test Form”) {
feed(userdetails)
exec(session => {
session.set(“viewstateLogin”, “")
session.set(“formViewState”, "”)
session
})
.exec{http(“login_user”)
.get("/en/login/")
.check(css(""“input[name=”__VIEWSTATE"]""", “value”).saveAs(“viewstateLogin”))
}
.pause(8,10)
tryMax(2){
exec{http(“post_login_form”)
.post("""/en/login/?returnurl=""")
.headers(headers_0)
.param("""__VIEWSTATE""", “${viewstateLogin}”)
//PARAMS HIDDEN
.check(regex(""“Hi, Test.”"").exists)
}.pause(8,10)
}.exitHereIfFailed
.exec{http(“navigate_members_only”)
.get("/en/members/")
}
.exec{http(“nav_competition”)
.get("/en/members/testform/")
.check(css(""“input[name=”__VIEWSTATE"]""", “value”).saveAs(“formViewState”))
}
.pause(8,10)
.exec{http(“post_competition_form”)
.post("""/en/members/testform/""")
.headers(headers_0)
.param("""__VIEWSTATE""", “”"${formViewState}""")
//PARAMS HIDDEN
.check(regex(""“
Thankyou
”"").exists)}
}
.exec(flushSessionCookies)
`
However, the above scenario is failing when it is run with the following message
“No attribute named ‘viewstateLogin’ is defined”
I have other scenarios that involve the same steps however, are using only one session attribute and these pass successfully.
I can only assume that there is either an issue with the chaining of my exec statements which is causing me to loose my session attributes,
or there is an issue with the way in which I am creating or retrieving the attributes themselves.
I have searched for answers but I am completely out of ideas.
Any help will be greatly appreciated
Thanks