#142 Surface HTTP Response Status Codes

Version_2.next
open
5
2012-09-15
2011-11-08
Jesse Webb
No

Our WatiN test suites all use the Page pattern to navigate through our websites. We also use the Page.IsCurrentDocument in assertions to verify the UrlRegex matches and the IsSecure flag is respected.

Unfortunately, we have come across a scenario where one of our pages is causing an Exception. The page is not displayed correctly (stacktrace is shown instead) and the HTTP status code is 500. The bad part is that the Page.IsCurrentDocument property still returns 'true' because the URL is correct and it is secure as class Page class attributes specify.

I would like to request that the HTTP status codes get surfaced by either the Page class or the Browser itself so that I may do assertions on it. It would be optimal for the Browser class to surface the entire Response object so that we could also check things like headers or client metadata. I would even be happy if you just changed Page.IsCurrentDocument to verify a non-4XX and non-5XX status code.

Other users also desire this feature. I found this StackOverflow question for a similar feature. There is an answer but the solution is kind of clunky for something that should be so simple.

http://stackoverflow.com/questions/7355170

Discussion