Reputation: 2361
I'm converting some web tests that use the ValidateResponseUrl class into NUnit tests. This is supposed to validate that the final url after all redirects matches the recorded response url. How do I do this in C#?
I see no documentation on how exactly the webtests do this or what the "recorded response url" is.
So I guess I have two questions.
After that it's just a matter of comparing the two.
Upvotes: 0
Views: 143
Reputation: 14066
One way is to ask Visual Studio how it does it. Open the ".webtest" file as normal in Visual Studio then click Generate Code button on the toolbar. Examine the generated file and copy any code or ideas you find useful. See also this Microsoft page.
Another route might be available. Both web test plugins and web test request plugins can access most parts of the responses. For example a web test request plugin can access the response by overriding the PostRequest()
method. It is also possible to write you own validation rule. Some combination of these, possible seeing how they are called from the generated code, may provide your answer.
Upvotes: 1