I am using web tests within team system and I am trying to record a test on pages which uses Anthem (ajax similar to Atlas) - the teste arent recording the ajax and I have attempted to use fiddler to record the traffic and have managed to do this, however when I try to manually add the steps in I am getting an issus wheer the test cannot find one of the anthem controls.
WebTestRequest request2 = new WebTestRequest(http://localhost/Default.aspx);request2.ThinkTime = 7;
request2.Method = "POST";
request2.QueryStringParameters.Add("Anthem_CallBack", "true");
FormPostHttpBody request2Body = new FormPostHttpBody();
request2Body.FormPostParameters.Add("Anthem_UpdatePage", "true");
request2Body.FormPostParameters.Add("__EVENTTARGET", "ctl00TicketContentArea$DealingControl$btnNewTicket");
request2Body.FormPostParameters.Add("__EVENTARGUMENT=", "");
I am a litte lost with how to get the anthem button to fire.
Can anyone help with any advice
Thanks
Gregor Suttie

Web Testing using Anthem (ajax)
John Schleicher
Gregor,
I'm not familar with Anthem, but I'm guessing there is a problem related to hidden fields that were changed in javascript. This is a common bug that we are close to releasing a fix for in a hotfix and the upcoming VS 2005 SP1. The problem is described in my white paper here: http://msdn.microsoft.com/library/default.asp url=/library/en-us/dnvs05/html/WTAuthDebug.asp
If that's not the issue, can you describe exactly what error you're seeing
Josh
Alexan
Hi Josh
Basically if i have a page with an anthem button and an anthem textbox on it and i record the test i get nothing which is all good - I run the test using fiddler and get the webtest via notepad:
This shows me the following:-
< xml version="1.0" encoding="utf-8" >
<TestCase Name="MicrosoftFiddlerWebTest" Id="" Owner="" Description="" Priority="0" Enabled="True" CssProjectStructure="" CssIteration="" DeploymentItemsEditable="" CredentialUserName="" CredentialPassword="" Proxy="" RequestCallbackClass="" TestCaseCallbackClass="">
<Items>
<Request Method="POST" Version="1.1" Url="http://localhost:55864/ActiveTraderWeb/Default2.aspx" ThinkTime="0" Timeout="0" ParseLinks="False" FollowRedirects="False" Cache="False">
<Headers />
<QueryStringParameters>
<QueryStringParameter Name="Anthem_CallBack" Value="true" UseToGroupResults="False" />
</QueryStringParameters>
<FormPostHttpBody ContentType="application/x-www-form-urlencoded; charset=utf-8">
<FormPostParameter Name="Anthem_UpdatePage" Value="true" URLEncode="True" />
<FormPostParameter Name="__VIEWSTATE" Value="/wEPDwULLTIwMzAzODQxNTlkZEz0KsIjrGNw2Gp6qfugI98XzrvN" URLEncode="True" />
<FormPostParameter Name="TextBox1" Value="" URLEncode="True" />
<FormPostParameter Name="__EVENTVALIDATION" Value="/wEWAwKq1Y3jCAKM54rGBgLs0bLrBnWOMyfK9nu0mwETclR9iafJxVpk" URLEncode="True" />
<FormPostParameter Name="__EVENTTARGET" Value="Button1" URLEncode="True" />
<FormPostParameter Name="__EVENTARGUMENT" Value="" URLEncode="True" />
</FormPostHttpBody>
</Request>
</Items>
</TestCase>
Now when i add this in I get an anthem error which is that it cannot find the control or I get a validation of viewstate mac failed error.
Anthem basically is just the exact same as an asp:button or asp:textbox but it allws callbacks.
Any further ideas
Cheers
Gregor
tommy khan
Ok, the problem (at least the first one) is that the __VIEWSTATE and __EVENTVALIDATION fields are hard-coded into the test. These values need to be dynamically extracted from the page at runtime and that value needs to be included in the postback request. The standard web test recorder (which does not support AJAX) will automatically match up such hidden field values and form parameters and add the ExtractHiddenFields rule and context bindings where necessary. You'll need to manually do something similar.
The idea is to add ExtractHiddenFields to the initial GET request and then modify the value of the __VIEWSTATE form parameter to be something like {{$Hidden1.__VIEWSTATE}}. This will pull the extracted value out of the context at runtime.
I hope this makes the process somewhat clear. Let me know if you have any questions.
Josh
scotland
Hi John
Many thanks for that reply - you shed some light on exactly what I was looking for and I managed to get it working.
Thanks a lot as I was going round in circles looking for the solution.
Cheers
Gregor