Can anyone tell me how to create an extraction rule that will allow me to pull an ID from an MVC querystring?
Scenario:
User hits site, and clicks "Add new"
Request: www.site.com/item/create
Response: www.site.com/item/view/2143
The site will instantly create a new item and redirect them to the viewitem page. The id i would like to extract lives within the response after item/view/####
Current recorded code for webtest:
var request4 = new WebTestRequest((Context["WebServerAddress"] + "/Item/Create"));
request4.Method = "POST";
var request4Body = new FormPostHttpBody();
request4.Body = request4Body;
yield return request4;
request4 = null;
//server redirect response happens now
var request5 =
new WebTestRequest((Context["WebServerAddress"] + "/Item/Edit/?needIdForHere"));
yield return request5;
request5 = null;
Any ideas?
Many thanks,
Kohan
you may get more mileage setting the value from the WebTestContext.LastResponse.ResponseUri
as an extraction rule is designed for iterating over the response body.