pass session attribute value to after hook?

34 views
Skip to first unread message

Nico Janssens

unread,
Sep 19, 2016, 10:06:24 AM9/19/16
to Gatling User Group
Hi ,

In one of my tests I would like to run some cleanup code after the simulation (after hook) which should delete some database entries. However in order to delete the correct database record, I should be able to pass a session attribute id value as some kind of variable to the after hook block of code. Any idea how this can be achieved?

Thanks!

Nikolay Degkin

unread,
Sep 22, 2016, 5:40:52 AM9/22/16
to Gatling User Group
Save variables to text doc and then read?

val writer = {
    val fos
= new java.io.FileOutputStream("foo.txt")
   
new java.io.PrintWriter(fos,true)
 
}

.exec { session =>
 writer
.println(session("ID").as[String])
 session
 
}
Reply all
Reply to author
Forward
0 new messages