Pages

Friday, April 23, 2010

VS2010 warning in Class Library for custom rules

I installed Visual Studio 2010 Ultimate. They added some new features to the web tests which are really awesome. My favorite is in the Web Test results, new toolbar button that says "go to Web Test" and it takes you directly to the Request. It was hard to figure out which request caused the failure sometimes. Loops and Conditions can now be added to the web tests. Actually Web Tests were renamed to Web Performance Tests. The tests can now check response times, which looks promising.

I have a Class Library for Custom Extraction Rules and Custom Validation Rules. I got warnings when I built the Solution in 2010, but I did figure out why eventually and fixed them. The warning says that overriding RuleName and RuleDescription is now obsolete. Here is that actual message:

warning CS0672: Member 'CustomValidationExtractionRules.QueryStringExtraction.RuleName' overrides obsolete member 'Microsoft.VisualStudio.TestTools.WebTesting.ExtractionRule.RuleName'. Add the Obsolete attribute to 'CustomValidationExtractionRules.QueryStringExtraction.RuleName'

I didn't know what they meant by add the obsolete attribute to RuleName (I'm not a programmer), but here's how I figured it out. Viewed the Class Library in the Object Explorer and browsed to CustomValidationExtractionRules> QueryStringExtraction> Base Types> Extraction Rule> RuleName. Under Summary it says "This method is no longer used. Use the System.ComponentModel.DisplayNameAttribute on the class to set a display name for this rule." So I looked up System.ComponentModel.DisplayNameAttribute and used the example to figure out I need to add two properties above the class definition, like this:

[Description("Demonstrates DisplayNameAttribute.")]
[DisplayName("RenamedProperty")]
public bool MisnamedProperty

Also needed to add "using System.ComponentModel;"

I'm a tester, not a programmer, but I'm learning.

No comments: