teezee
teezee

Reputation: 11

Using TestCategory attribute in Silverlight unit tests

I'm trying to write some unit tests in a Silverlight project and I wanted to tag them with attributes like we do in a regular test project (VS2010). For example, something like this:

[TestMethod]
[TestCategory("BVT")]
public void TestMethod1()
{
}

I added a reference to Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll whoever, when I try to tag the test case, TestCategory attribute is not available.

Is there a way for me to use all the members/attributes available in Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll?? I can't add that as a reference since I'm working in a Silverlight project.

Thanks!!

Upvotes: 1

Views: 491

Answers (1)

Roman Denysenko
Roman Denysenko

Reputation: 21

You can tag your method like this:

[TestMethod]
[Tag("BVT")]
public void TestMethod1()
{
}

Also you can customize you Silverlight Framework UI examples by changing App.xaml.cs like this:

private void Application_Startup(object sender, StartupEventArgs e)
{
    UnitTestSettings settings = UnitTestSystem.CreateDefaultSettings();
    settings.SampleTags.Clear();
    settings.SampleTags.Add("All");
    settings.SampleTags.Add("BVT");
    RootVisual = UnitTestSystem.CreateTestPage(settings);
}

Upvotes: 2

Related Questions