locked
I need to get tests back in my test list editor after deletion. RRS feed

  • Question

  • I was trying to organize my test in the test editor within VS2010 and for whatever brain damage I had at that moment I deleted the test from my test view.  I have no tests in my project now.  All the code is still present how do I get the project to detect my tests again?   I've unloaded, reloaded, taken the cs files out and put them back in with no result.   Thanks for any help!!!


    • Edited by Denihawk Monday, August 13, 2012 3:37 PM
    Monday, August 13, 2012 3:17 PM

Answers

  • Hi Denihawk,

    It sounds like you just need to go back into your .cs files and identify each of yours test methods as TestMethod.

    It should look something like this:

    namespace Testing
    {
    [CodedUITest]
    public class TestRunner
    {
    [TestMethod]
    public void Test1()
    {
    this.UIMap.Step1();
    this.UIMap.Step2();
    ....
    }

    [TestMethod]
    public void Test2()
    {
    this.UIMap.Step1();
    this.UIMap.Step2():
    ....
    }
    }
    }

    Since you said that all the code is still there, I assume that your .cs file(s) look(s) almost exactly like it did before with the exception of the [TestMethod] attribute right above each of your test methods.

    Hope this helps,

    Nat

    • Proposed as answer by Nataliya Ramirez Monday, August 13, 2012 3:54 PM
    • Marked as answer by Denihawk Monday, August 13, 2012 3:55 PM
    Monday, August 13, 2012 3:49 PM

All replies

  • Hi Denihawk,

    It sounds like you just need to go back into your .cs files and identify each of yours test methods as TestMethod.

    It should look something like this:

    namespace Testing
    {
    [CodedUITest]
    public class TestRunner
    {
    [TestMethod]
    public void Test1()
    {
    this.UIMap.Step1();
    this.UIMap.Step2();
    ....
    }

    [TestMethod]
    public void Test2()
    {
    this.UIMap.Step1();
    this.UIMap.Step2():
    ....
    }
    }
    }

    Since you said that all the code is still there, I assume that your .cs file(s) look(s) almost exactly like it did before with the exception of the [TestMethod] attribute right above each of your test methods.

    Hope this helps,

    Nat

    • Proposed as answer by Nataliya Ramirez Monday, August 13, 2012 3:54 PM
    • Marked as answer by Denihawk Monday, August 13, 2012 3:55 PM
    Monday, August 13, 2012 3:49 PM
  • Well that did it, thanks so much Nat!!!


    -d

    Monday, August 13, 2012 3:53 PM
  • You're very welcome! :)

    Nat

    Monday, August 13, 2012 3:54 PM