Forum Discussion
HKosova
Alumni
14 years agoHi Baba,
First of all, may I ask you what you would need to do this at run time for? If you need this to update the originally recorded task, you can manually replace the request URL in the Task editor before the test run. Or, you can delete the old request and record a new one in its place (append recording to the existing task, then move the new request to the needed place in the task). That would be easier and with no overhead to the test performance, whereas, load testing event handlers may slow down the test execution.
If you are sure that you want to stick with run-time modification, you'll need to perform a string replace in the Request.RequestHeader value within the OnLoadTestingRequest event handler, and replace the original URL with the needed URL. Here's an example:
By the way, have you seen our new load testing tool - LoadComplete? Version 2 is currently in beta with many major improvements. Would you possibly be interested to try it out?
First of all, may I ask you what you would need to do this at run time for? If you need this to update the originally recorded task, you can manually replace the request URL in the Task editor before the test run. Or, you can delete the old request and record a new one in its place (append recording to the existing task, then move the new request to the needed place in the task). That would be easier and with no overhead to the test performance, whereas, load testing event handlers may slow down the test execution.
If you are sure that you want to stick with run-time modification, you'll need to perform a string replace in the Request.RequestHeader value within the OnLoadTestingRequest event handler, and replace the original URL with the needed URL. Here's an example:
Sub GeneralEvents_OnLoadTestingRequest(Sender, User, Request)
' Replace 42 in the below condition with the request # in the task
If Request.RequestID = 42 Then
Request.RequestHeader = aqString.Replace(Request.RequestHeader, "/xyz/abc.aspx", "/123/345.aspx")
End If
End Sub
By the way, have you seen our new load testing tool - LoadComplete? Version 2 is currently in beta with many major improvements. Would you possibly be interested to try it out?