chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
Welcome to Typemock Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes
I have a use case for unit tests that extend a base class for common class initialization and cleanup work. Using MSTest, this code looks like this:
[TestClass]
public class BaseTestClass
{
    [TestInitialize]
    public void BaseTestInitialize()
    {
        Console.WriteLine("BaseTestInitialize");
    }
}

[TestClass]
public class TestingClass : BaseTestClass
{
    [TestInitialize]
    public void TestInitialize()
    {
        Console.WriteLine("TestInitialize");
    }
    
    [TestMethod]
    public void TestSomething()
    {
        Console.WriteLine("TestSomething");
    }
}


If I run this code using the test explorer in visual studio, and TMockRunner.exe, I get the following output, which I am expecting:
BaseTestInitialize
TestInitialize
TestSomething


Running the same TestSomething test from the SmartRunner plug-in or by clicking the shield and running the test, I get the following:
TestInitialize
BaseTestInitialize
TestSomething


It just looks like the SmartRunner is running the initialization methods in the wrong order. TestCleanup works as expected because it probably uses the same logic as the piece handling TestInitialize today.

I'm using TypeMock 7.3.0.0 and the associated plug-in that gets installed with that version. Has this bug been addressed in newer versions of TypeMock or is there a suitable workaround?
asked by dnglaze (1.4k points)

13 Answers

0 votes
Hi,

Thank you for the feedback.
We are looking into it, I'll update you ASAP.
answered by alex (17k points)
0 votes
Hi,

Please try to run the following line from CMD:
"C:Program Files (x86) [Microsoft Visual Studio version] Common7IDEdevenv.exe /setup"

It should register the runner in Visual Studio.
Let me know if it helps.
answered by alex (17k points)
0 votes
Running that command seems to have made everything happy. Looks like the fix works. Thanks!
answered by dnglaze (1.4k points)
...