CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2009
    Posts
    6

    Can we get the data of Test List Editor

    Hi,
    In Visual Studio, we have the option to create Unit Tests of a function/method through the item "Create Unit Tests" which we can see when we open the context menu of a function/method. (found at http://msdn.microsoft.com/en-us/library/ms182532.aspx) If we open the Test List Editor, we can see many columns like "Test Name", "Test Description", "Test Timeout", etc.. for each Unit Test that is created. Some more columns also can be added to a particular Test via the Test List Editor. As per our project requirement, the end - user will supply the inputs like Test name, test descirption, etc at the time he/ she creates Unit test and we have to use these input values to write them into a seperate xml file. Can we get the values of these columns programmatically and supply them as inputs to the customized methods? Please help..

    Thanks in advance,
    Sravani

  2. #2
    Join Date
    Mar 2004
    Location
    Prague, Czech Republic, EU
    Posts
    1,701

    Re: Can we get the data of Test List Editor

    With exception of test name, which is derived from test method name, all other information are attached to the test with attributes (e.g. DescriptionAttribute, TimeoutAttribute). All information you can get from test assembly with reflection, test method you can identify by attached TestMethodAttribute.
    Code:
    [TestMethod]
        [Description("xxxx")]
        [Timeout(500)]
        public void TestValidListener()
        {
        }
    Code:
    // let FooFixture be test class
    var tests = typeof(FooFixture).GetMethods().Where(m => m.GetCustomAttributes(typeof(TestMethodAttribute), false).Length > 0);
    • Make it run.
    • Make it right.
    • Make it fast.

    Don't hesitate to rate my post.

  3. #3
    Join Date
    Dec 2009
    Posts
    6

    Re: Can we get the data of Test List Editor

    Hi Boudino,

    During the execution of test, i looked for the values of DescriptionAttribute or TimeOUtAttribute, but could not be able to find the exact method/ object which holds the value of Test Description column in Test List Editor. If you dont mind, could you please explain in detail. I am very new to .Net.

    Thanks a lot ,
    Sravani

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured