MbUnit

Top  Previous  Next

Purpose

SeSMbUnit.vsi is a visual studio installer packaged with SmarteStudio.  It facilitates calling SmarteStudio tests from MbUnit tests.

 

Usage

 

Installation

You will need Visual Studio, MbUnit 3, and Gallio to use SeSMbUnit.  MbUnit is bundled with Gallio, which is available at www.gallio.org.

 

To install SeSMbUnit, open the following directory:

C:\Program Files\SmarteSoft\SmarteStudio\Extensions\UnitTesting\MBUnit\SeSMbUnit

 

Double-click SeSMbUnit.vsi.  The Visual Studio Content Installer will appear.  Select the components for the language you will use and then click Next.

 

Syntax

Use both the MbUnit.Framework and the SeSMbUnit namespaces:

 

using MbUnit.Framework;
using SeSMbUnit;

 

MbUnit uses the class attribute [Test] to identify test methods.  The corresponding attribute for SeSMbUnit is [SeSMbUnitTest(@"<path to .sstest>")].  Note that the SeSMbUnitTest attribute has a parameter, the file-path to the test that will be invoked.

 

The following example uses a test method simply as a wrapper for calling an .sstest:

 

[SeSMbUnitTest(@"T:\Samples\Cross Browser\CrossBrowser.sstest")]

public void TestIEandFirefox()

{

   int exitCode = SeSMbUnitHelper.TestExecute();

   Assert.AreEqual(0, exitCode);

}

 

Templates

SeSMbUnit.vsi will install a template for Visual Studio called SeSMbUnitTests.  The template includes the appropriate using statements and a blank test method.  You can insert additional SeSMbUnitTest methods by right-clicking in the editor in Visual Studio, and selecting Insert Snippet > SeSMbUnitTest.  The following code will be added:

 

[SeSMbUnitTest(/*Insert path to .sstest file which must be run.*/)]

public void TestSeS()

{

   int exitCode = SeSMbUnitHelper.TestExecute();

   Assert.AreEqual(0, exitCode);

}

 

You'll need to specify the file-path.

 

Samples

There is a sample dll you can run in MbUnit.  From the SmarteStudio directory, you'll find it at: Extensions\UnitTesting\MBUnit\SeSMbUnit\SeSSamplesMbUnit\bin\Debug\SeSSamplesMbUnit.dll

 

See Also

MbUnit and related documentation can be found at www.mbunit.com