Hi All,
I am trying to figure out how I can pass the token across the scenarios. Here is what I am trying to do.
I have created different scala objects for each scenarios I want to run and then I am running it as a list of scenarios. From the Object 1 I grabbed Xpath value and I am trying to pass it to the next object. For some reason the value in the 2nd object is always empty.
test.ob.Login
object Login {
val LoginHttpPost = http(“Login”)
.post("/post/to/this")
.check(xpath("//input[@value=‘1’]/a").saveAs(“Token”)) //Want to save this token here and then pass it to the next object below (Search Object)
val LoginPostScenario = scenario(“Login”).exec(LoginHttpPost )
}
test.ob.Search
object Search{
val SearchHttpPost = http(“Search”)
.post("/post/to/this")
.formParamMap(Map(“Token” → “${Token}”))
val SearchPostScenario = scenario(“Search”).exec(SearchHttpPost )
}
test.ob.Simulation
class TestSimulation extends Simulation {
val performanceTestScenarios = List(
Login.LoginPostScenario .inject(
atOnceUsers(1,
rampUsersPerSec(1) to 1 during(5 seconds)
),
Search.SearchPostScenario .inject(
atOnceUsers(1,
rampUsersPerSec(1) to 1 during(5 seconds)
)
)
setUp(performanceTestScenarios)
.protocols(httpConf)
.maxDuration(1 minutes)
}