Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


#142 Surface HTTP Response Status Codes

Jesse Webb

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.