If your Web Test does not do what it is supposed to do (Part 1)
I had an opportunity to chat with Josh Christie tonight at the MS office while the Dallas .Net User Group October meeting was taking place. He told me about a bug that will be in the final release of VS2005 and about a common problem that is hard to troubleshoot. This post is about the bug.
The problem: "Some times" the event handler for some ASP.Net controls' click event does not get fired. And it can be hard to tell what is going on because the post back http request does occur, it just doesn't call the click event handler. I tried but could not reproduce it, probably because of the "some times" part. But the problem is that you because of this bug, when using ASP.Net controls that invoke the __doPostBack() JavaScript method (i.e. the LinkButton ASP.Net Control), the value of __EVENTTARGET may be Context-bound to a Hidden Field incorrectly, most likely ending up with an empty string value assigned to it, therefore not calling the event handler (i.e. LinkButton1_Click ).
Depending on the complexity of your web test, you may be able to spot this problem the first time you run the web test. Or, if in your page you are using ASP.Net controls that call __doPostBack() and during a test run you see something go wrong but don't know exactly what (because the post back actually takes place, it just doesn't have the correct parameters, which can make the problem hard to identify), you may want to see if your Web Test recording was a victim of this bug. Just look in the Body of the request that you think is acting weird (that is, on the request that calls the page that is not doing what it's supposed to). Again, if you are using one of the controls I mentioned, __VIEWSTATE should not be an empty string.
The Solution: In the Form Post Parameters of the request that you think was victimized by this bug, modify the value of __ENVENTTARGET to reflect the correct value.
As a Note, Josh tells me this always happens on __EVENTTARGET but based on the bug, it could happen on __EVENTARGUMENT or any other hidden field.