Skip to end of metadata
Go to start of metadata

During a load test, each virtual user composes the appropriate runtime requests, sends them to the server, and receives the corresponding runtime responses (a request/response combination is called a session). This process is part of the session life-cycle, that can be programmatically be altered by a component. In each step, the session properties can be accessed by the RuntimeSession object that is passed as an argument.

OnRequestInitialize

Called for every recorded request before the runtime request is composed.

  • If the recorded request is disabled or cached then the RuntimeSession.CancelRequest will be true.
  • Setting the RuntimeSession.CancelRequest to true will cancel sending the request to the server.
  • RuntimeSession.GetRequestHeaders(), RuntimeSession.GetRequestBody(), RuntimeSession.GetRawRequestBody() will return recorded request values.
  • RuntimeSession.SetRequestHeader(), RuntimeSession.SetRequestBody() will not do anything.
  • RuntimeSession.ResponseCode, RuntimeSession.GetResponseHeaders(), RuntimeSession.GetResponseBody(), RuntimeSession.GetRawResponseBody() will not return meaningful data.

OnBeforeRequest

Called after the runtime request is composed. Called only for requests that were not canceled due to being disabled or cached.

  • Setting the RuntimeSession.CancelRequest to true will cancel sending the request to the server.
  • RuntimeSession.GetRequestHeaders(), RuntimeSession.GetRequestBody(), RuntimeSession.GetRawRequestBody() will return request values that will be sent to the server.
  • RuntimeSession.SetRequestHeader(), RuntimeSession.SetRequestBody() will alter the outgoing request.
  • RuntimeSession.ResponseCode, RuntimeSession.GetResponseHeaders(), RuntimeSession.GetResponseBody(), RuntimeSession.GetRawResponseBody() will not return meaningful data.

OnBeforeResponse

Called immediately after the response came back. Use this event for custom validation. If the request was canceled previously then this method will not be called.

  • RuntimeSession.ResponseCode, RuntimeSession.GetResponseHeaders(), RuntimeSession.GetResponseBody(), RuntimeSession.GetRawResponseBody() will return response data from the server.
  • Call RuntimeSession.IsError and RuntimeSession.ErrorMessage to mark the incoming response as an error

OnAfterResponse

Called after the response is processed. Use this event to override extractor values and save the response. If the request was canceled previously then this method will not be called.

  • RuntimeSession.ResponseCode, RuntimeSession.GetResponseHeaders(), RuntimeSession.GetResponseBody(), RuntimeSession.GetRawResponseBody() will return response data from the server.
  • Override extractor values by using RuntimeSession.ExtractorRuntime
  • No labels