If your Web Test does not do what it is supposed to do (Part 2)
In my Part 1 post I mentioned that Josh Christie had told me about two common problems with web tests and I detailed one of them. Well, I finally got around to tell you about the other one:
The problem: During a Web Test Run you get an error like '$Hidden1__VIEWSTATE was not found in the web test context'.
This is not a problem that has a specific solution, instead what I have to offer (again, thanks to Josh) is that the description of this error can often be misleading. What it really means is that an error occurred but not in the page that is throwing this error but in the one immediately before that one. What happens is that if an error occurs and you do not have any validations for the page that is returned (which could potentially tell you, in the right page, when the error occurrs) the error is going to be ignored, let's say for instance that the error was a '404 - Page not found'; that page is not going to have a view state so the following HTTP request in the web test is not going to pass a view state value to the server, therefore causing this requested page to throw the error described above. In other words, the error is thrown on the 'Page 2' because 'Page 1' did not 'pass' the corret data to it, not because there is something wrong with 'Page 2'.
Hmmm... It looks like we may end up wanting to create a small set of basic validation rules that will be common to all web pages. Sort of like having all your code inside try..catch blocks.
Hope this helps. Please feel free to post your thoughts on this...