Search code examples
unit-testingseleniummbunit

Mbunit and selenium


Can anyone tell me how get mbunit to run more than one test at a time without it setting up and tearing down after every test?

Currently I'm using selenium for UI testing and need to run the tests consecutively do a login page.

Thanks in advance, cb


Solution

  • Are you looking for FixtureSetUp/FixtureTearDown attribute [used to be called TestFixtureSetUp], which is called at class level, meaning, it will be set up once for all the tests in one test class.

    Setup/TearDown attribute is called on Method level.

    MbUnit also support test assembly setup and teardown. Here is a link for this.

    [assembly: AssemblyCleanUp(typeof(AssemblyCleaner))]
    ...
    public class AssemblyCleaner
    {
        [SetUp]
        public static void SetUp()
        {
            Console.WriteLine("Setting up {0}", typeof(AssemblyCleanUp).Assembly.FullName);
        }
        [TearDown]
        public static void TearDown()
        {
            Console.WriteLine("Cleaning up {0}", typeof(AssemblyCleanUp).Assembly.FullName);
        }
    }