Vadim's Weblog

Never stop learning.

Addition to Julian Hidalgo blog on TestSequence attribute.

Posted by Vadim on May 30, 2007

MbUnit contributor, Julian Hidalgo, blogs about using TestSequence attribute. He points out the typical mistake people have when they try to use this attribute for the first time. When I tried to use it for the first time, I also used TestFixture attribute instead of ProcessTestFixture one.

Julian did a good job of demonstrating how to use it. I would like to add that when you put your tests in ProcessTestFixutre, MbUnit will combine all your tests into one big test. The name of the big test will be all your test names separated by a period in the order specified by TestSequence attribute. For instance, if you have a fixture like the one bellow (borrowed from Julian’s blog), your big test name will be SequenceAttributeTest.Test1.Test2.

    [ProcessTestFixture]
    public class SequenceAttributeTest
    {
        private int i = 0;
        [Test]
        [TestSequence(2)]
        public void Test2()
        {
            i += 1;
            Assert.AreEqual(i, 2);
        }

        [Test]
        [TestSequence(1)]
        public void Test1()
        {
            i += 1;
            Assert.AreEqual(i, 1);
        }
    }

Another thing I’d like to mention is that if one of the tests fails, the execution stops. It means that no test will be executed after failed test.  If in example above Test1 fails, Test2 will not be run.

Unfortunately, you cannot use RowTest in ProcessTestFixutre.

3 Responses to “Addition to Julian Hidalgo blog on TestSequence attribute.”

  1. Hi Vadim

    Thanks for adding more info, I think this a very useful MbUnit feature :)
    By the way, what happened to your other blog?

  2. vkreynin said

    I switched from Blogger because WordPress has more features. Plus I get great stats about my posts with WordPress.

  3. Stranger said

    It was certainly interesting for me to read that post. Thanks for it. I like such topics and everything connected to them. I would like to read more soon.

    Best regards

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: