How to...

Coordinator
Feb 1, 2008 at 10:29 PM
Edited Feb 2, 2008 at 9:42 PM
To use the extensions, do the following:

- Add a reference to "MSTestExtensions.dll", the assembly willl appear in the Visual Studio "Add References" dialog. For VS2005, add a reference to version "1.0.0.0", for VS2008 add a reference to version "2.0.0.0".
- Add a using statement for namespace "MSTestExtensions"
- Get you Test Class to inherit from "MSTestExtensionsTestFixture".
- Decorate your Test Methods with "TestTransaction" (equivalent to "RollBack in MbUnit"), "ExpectedExceptionMessage", or "TestTimer".

More details here: http://callumhibbert.blogspot.com/2008/01/extending-mstest.html
Apr 2, 2008 at 1:44 AM
Does it use like Nunit?
Coordinator
Apr 19, 2008 at 2:54 PM
No, there is no dependency on NUnit or any other framework. You just need a version of Visual Studio that supports MSTest, these are:

- For Visual Studio 2008, you need the Professional Edition or higher.
- For Visual Studio 2005, you need one of the Team Editions (Developer or Test).
Jun 14, 2008 at 10:49 AM
Hi, I'm having a probem running TestTimer. Its a very simple test
        private class Class1
        {
            public Class1() { }

        }

        [TestMethod]
        [TestTimer(10)]
        public void TestMethod1()
        {
            Class1 class1 = new Class1();
            //Thread.Sleep(TimeSpan.FromSeconds(120));
            for (int i = 0; i < 1000; ++i)
            {
                Console.WriteLine("Do something slow");
            }
            Assert.IsNotNull(class1);
        }



The test passes - while I'm expecting it to fail as the test need to fail after 10ms. As you can see that I also tried with a thread sleep.

Another issue:
I've downloaded the source but am having trouble opening the solution as it seems to require access to some EdenBrook targets file. I hope I'm just being stupid and need a pointer to RTFM.

Many thanks Preet
Jun 14, 2008 at 10:52 AM
LOL. Just saw the MSTestExtensionsTestFixture base class :-) Ok forgive me (it's 11pm here in NZ),  the first issue is  solved.

preetsangha wrote:
Hi, I'm having a probem running TestTimer. Its a very simple test
        private class Class1
        {
            public Class1() { }

        }

        [TestMethod]
        [TestTimer(10)]
        public void TestMethod1()
        {
            Class1 class1 = new Class1();
            //Thread.Sleep(TimeSpan.FromSeconds(120));
            for (int i = 0; i < 1000; ++i)
            {
                Console.WriteLine("Do something slow");
            }
            Assert.IsNotNull(class1);
        }



The test passes - while I'm expecting it to fail as the test need to fail after 10ms. As you can see that I also tried with a thread sleep.

Another issue:
I've downloaded the source but am having trouble opening the solution as it seems to require access to some EdenBrook targets file. I hope I'm just being stupid and need a pointer to RTFM.

Many thanks Preet



Coordinator
Sep 23, 2008 at 9:09 PM
Hi Preet,

Sorry for not replying, this project is fairly quiet so I don't check it too often. For some reason I'm not being sent e-mail notifications when there are new posts.

Anyway, to answer your question regarding the targets file. I am leveraging some MSBuild artefacts from my employer. Do a search for the Import statement and delete it. You will then get some errors when you build the solution (because it can't find an MSBuild Task). Remove the guilty Task.

Regards,

Callum