Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 392773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:11:32+00:00 2026-05-12T16:11:32+00:00

What is the syntax to use the [TestDescriptionAttribute][1] of a test to populate the

  • 0

What is the syntax to use the [TestDescriptionAttribute][1] of a test to populate the Description column in the Test Results window?

Context: Visual Studio 2008 Team System

I’ve read the documentation, but am not able to find a concrete example.

Based, loosely, on Ngu’s suggestion, I’ve tried:

using GlobalSim;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.VisualStudio.TestTools.WebTesting;

namespace GlobalSimTests {

    /// <summary>
    ///This is a test class for PongerTest and is intended
    ///to contain all PongerTest Unit Tests
    ///</summary>
    [TestClass()]
    [TestDescriptionAttribute( "hello" )]
    public class PongerTest {

        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext {
            get {
                return testContextInstance;
            }
            set {
                testContextInstance = value;
            }
        }

        /// <summary>
        ///A test for Ping
        ///</summary>
        [TestMethod()]
        public void PingTest () {
            Ponger target = new Ponger();
            string expected = "Pong";
            string actual;
            actual = target.Ping();
            Assert.AreEqual( expected, actual );
        }

    }
}

This compiles, but doesn’t display the test description in the Description column of the Test Results window.

alt text

I’ve also tried this syntax:

    /// <summary>
    ///A test for Ping
    ///</summary>
    [TestMethod()]
    [TestDescription( "hello" )]
    public void PingTest () {
        Ponger target = new Ponger();
        string expected = "Pong";
        string actual;
        actual = target.Ping();
        Assert.AreEqual( expected, actual );
    }

Which returns from the compiler:

Attribute ‘TestDescription’ is not valid on this declaration type. It is only valid on ‘class’ declarations.

Here is the syntax that works. Thanks all!

    /// <summary>
    ///A test for Ping
    ///</summary>
    [TestMethod()]
    [Description( "Hello" )]
    public void PingTest () {
        Ponger target = new Ponger();
        string expected = "Pong";
        string actual;
        actual = target.Ping();
        Assert.AreEqual( expected, actual );
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T16:11:32+00:00Added an answer on May 12, 2026 at 4:11 pm

    As @Ngu has said, put it on the top of a test method

    [TestMethod()]
    [Description( "PingTest Check" )]
    public void PingTest () {
         Ponger target = new Ponger();
         string expected = "Pong";
         string actual;
         actual = target.Ping();
         Assert.AreEqual( expected, actual );
      }
    

    EDIT: TestDescriptionAttribute is from WebTesting namespace, which should not be applied for unit testing. Use the DescriptionAttribute instead, which is part of the UnitTesting namespace.

    See the modified code above & I am sure, it will work.

    EDIT2: To find something like that, look at the classes in the same namespace. That is how classes are arranged, so that one can find it easily.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Question: What is the correct syntax to use when selecting a column value into
I want to use syntax highlighting along with redcloth. The description of coderay says:
I have been recently working on an easy to use Syntax Highlighting system for
What is the regex syntax to use part of a matched expression in the
I am looking for the SQL syntax to use HAVING in the following statement:
In SQLServer, you can use syntax (nolock) to ensure the query doesn't lock the
I am having a bit of trouble figuring out the exact syntax to use
I use the syntax foldmethod in vim 7.3. In .vimrc: set foldmethod=syntax When I
In MySQL you can use the syntax DELETE t1,t2 FROM table1 AS t1 INNER
I would like to use the syntax that printf uses, using the %d, %s

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.