phuccaoca123 / mb-unit

Automatically exported from code.google.com/p/mb-unit
0 stars 0 forks source link

Gallio runs MbUnit v2 tests inside types that are not marked as fixtures #51

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
If you have this code:

extern alias MbUnit2;
using MbUnit2::MbUnit.Framework;

namespace Problem
{
    public class ProofOfConcept
    {
        private string aString = null;

        [TestFixtureSetUp]
        public void FixtureSetUp()
        {
            aString = "This is never executed";
        }

        [Test]
        public void CheckString()
        {
            Assert.IsTrue(aString.Length > 0);
        }
    }
}

And you try to run the CheckString test, it will be executed but it will
fail with a null reference exception. The problem is that the type is not
marked as a fixture and the fixture setup method is never executed.
This is confusing since it can be hard to notice that the fixture attribute
is missing. Not running the test would be also confusing in my opinion, I
think the best option would be to throw an exception like
"TestNotInFixture" with an appropriate message or something like that.

Original issue reported on code.google.com by julian.h...@gmail.com on 4 Sep 2007 at 6:54

GoogleCodeExporter commented 9 years ago
Something strange going on here.  This is an MbUnit v2 test after all...

Original comment by jeff.br...@gmail.com on 4 Sep 2007 at 11:29

GoogleCodeExporter commented 9 years ago
I think this may be related to the MbUnit v2 feature for "naked fixtures".  As 
such 
it is behaving by design.

Original comment by jeff.br...@gmail.com on 30 Oct 2007 at 2:09

GoogleCodeExporter commented 9 years ago
By design.
This is an MbUnit v2 feature that's leaking into Gallio.

Note: Naked fixtures probably won't be supported by MbUnit v3.

Original comment by jeff.br...@gmail.com on 29 Nov 2007 at 12:43