locked
Test explorer doesn't show static test methods RRS feed

  • Question

  • Hi All,

    I am developing unit test methods to generate some XMLs. When I declares a [TestMethod] as static, test explorer doesn't show it in the list. i am using VSTS 2012. Any comments please.

    Tuesday, July 14, 2015 12:37 PM

Answers

  • Hi Deependra,

    Thank you for posting in MSDN forum.

    I tried to create a simple unit test and then declares a [TestMethod] as static like the following screen shot.

    Then I tried to build the unit test project, but I found that I am also not see the testmethod show in this test explorer window.

    And I know that it is default that each unit test is a test method that is marked with the[TestMethod()] attribute. These attributes are assigned automatically when unit tests are generated. Therefore, I think that the [TestMethod()] attribute is not support a [TestMethod] as static in unit test by design.

    If you still want to this feature request, I suggest you could submit this request:

    http://visualstudio.uservoice.com/forums/121579-visual-studio. The Visual Studio product team is listening to user voice there. You can send your idea there and people can vote. If you submit this suggestion, I hope you could post that link here, I will help you vote it.

    Thanks for your understanding!

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.



    • Edited by Tina-Shi Wednesday, July 15, 2015 6:37 AM
    • Marked as answer by Tina-Shi Tuesday, July 21, 2015 9:45 AM
    Wednesday, July 15, 2015 6:33 AM

All replies

  • Hi Deependra,

    Thank you for posting in MSDN forum.

    I tried to create a simple unit test and then declares a [TestMethod] as static like the following screen shot.

    Then I tried to build the unit test project, but I found that I am also not see the testmethod show in this test explorer window.

    And I know that it is default that each unit test is a test method that is marked with the[TestMethod()] attribute. These attributes are assigned automatically when unit tests are generated. Therefore, I think that the [TestMethod()] attribute is not support a [TestMethod] as static in unit test by design.

    If you still want to this feature request, I suggest you could submit this request:

    http://visualstudio.uservoice.com/forums/121579-visual-studio. The Visual Studio product team is listening to user voice there. You can send your idea there and people can vote. If you submit this suggestion, I hope you could post that link here, I will help you vote it.

    Thanks for your understanding!

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.



    • Edited by Tina-Shi Wednesday, July 15, 2015 6:37 AM
    • Marked as answer by Tina-Shi Tuesday, July 21, 2015 9:45 AM
    Wednesday, July 15, 2015 6:33 AM
  • Your reply is the only documentation regarding MS Test static test method.
    Wednesday, June 6, 2018 7:49 AM