I have been trying to set up an automated test to verify that a link on a specific page has the correct URL.
When recording a web test and clicking on a link on a page it saves the URL into memory. I want to simulate clicking on a specific link on a page and verify that not only did the link go somewhere but that it went to the expected URL.

Web test for a link on a page to have the correct URL
TheBeard
One way to do this is to parse the HTTP response and look for the particular <a href...> tag. To make parsing eaiser you can include some HTML comment near the <a href...> tag.
To accomplish this, you can generate code for a web test and add the code to test the correcness of the URL also.
Hope this helps.
kangkang
You can use a vaildation rule to verify the response went to the correct URL. Check out the following posts for more information on creating validation rules:
http://forums.microsoft.com/msdn/ShowPost.aspx PostID=53699
http://forums.microsoft.com/msdn/ShowPost.aspx PostID=19485
What you would want to do is access the response object in the validation rule Validate method. If it is equal to the value you expect, then you set the isValid property of the event args class to true, and if it is incorrect you set it to false. After creating the rule, you right click on the request that you want to validate and choose Add Validation Rule... Your new rule should appear in the dialog that pops up. After adding your rule, click play in the web test editor to verify that the rule executed as expected. You can click on the request that the rule was added to and then click on the details tab. This tab has information about what rules were executed and if they were successfu.
USNgineer
Simple test is:
Navigate to the Google website
Verify the Business Solutions link URL is correct
I recorded the test - going to the Google website
then clicking on the business solutions link
Added validation rule to web test entry http://www.google.com/ - ValidationRuleFindText
Went to properties of ValidationRuleFindText and set parameter FindText to
<a href=/services/>Business Solutions<
The validation rule searches the HTML response (the same text seen in View - Source in the browser) for the text string and returns pass/fail
In addition the correct URL can be checked to make sure it goes somewhere
(This doesn't check if the link appears on the correct area of the page but it is good enough for regression testing)