Hi,
I am trying to figure out a way to set a variable (myRequestContentVar) inside my customProtocol class.
Here is a snippet:
`
class MyAction(val username: Expression[String], val password: Expression[String], val payload: Expression[String], apiClass: ApiClass, requestName: String, next: ActorRef) extends Action {
val gatlingRequestResponse: GatlingRequestResponse = ???
def initThisGuy(username: String, password: String, payload: String): Unit = {
apiClass.setInputParameter(0, username)
apiClass.setInputParameter(1, password)
apiClass.setInputParameter(2, payload)
apiClass.execute(gatlingRequestResponse)
apiClass.setSomeMore(gatlingRequestResponse)
}
def execute(session: Session) {
val requestStartDate = currentTimeMillis()
val responseEndDate = currentTimeMillis()
initThisGuy(username(session).get, password(session).get, payload(session).get)
// TODO
// session.set(“myRequestContentVar”, apiClass.getRequestContent())
…
val requestEndDate = requestStartDate
val responseStartDate = responseEndDate
val requestResult = OK
val requestMessage = if (requestResult.equals(“OK”)) {
“Success”
} else {
“Fail”
}
var errorMessage2: Option[String] = None
val extraInfo = Nil
DataWriter.dispatch(RequestMessage(
session.scenarioName,
session.userId,
session.groupHierarchy,
requestName,
requestStartDate,
requestEndDate,
responseStartDate,
responseEndDate,
requestResult,
errorMessage2,
extraInfo))
next ! session
}
}
`
I took some clues from below post but it didnt helped:
https://groups.google.com/forum/#!searchin/gatling/def$20execute(session$3A$20Session)$20{|sort:relevance/gatling/OPoUkhZMAAk/ozGix5akAzAJ
Any pointers would be helpful.
-Ashish