Running DBTestUnit tests using MBUnit


The following gives a brief overview on how to use MBUnit (v 2.41.232.0) using the GUI or console.

This version of MBUnit is the default testing framework up to version 0.4.0.428 of DBTestUnit.

It assumes MBUnit has been installed to C:\Program Files\MbUnit\.

GUI
1. Open the GUI via: C:\Program Files\MbUnit\MbUnit.GUI.exe

2. Click on ‘Assemblies – Add Assemblies’

Browse to location of the the database unit test dll to be tested.

eg for AdventureWorks – the example database used in previous blogs – browse to:

C:\Projects\AdventureWorks\src\AdventureWorksDatabaseTest\bin\Debug\
AdventureWorks.DatabaseTest.dll

3. The following image shows what the GUI looks like:


To run the tests simply click the ‘Run’ button.

Individual tests or groups of tests can be run by selecting various nodes on the hierarchy on the left hand side.
Console
1. The console can be run via: C:\Program Files\MbUnit\MbUnit.Cons.exe.

2. The following sample bat script could be used to run all the sample AdventureWorks database unit tests.


SET testDll=C:\Projects\AdventureWorks\src\AdventureWorksDatabaseTest\bin\Debug\AdventureWorks.DatabaseTest.dll

cd C:\Program Files\MbUnit\

MbUnit.Cons.exe %testDll% /v

3. The following examples show a number of different switches that can be used to limit the set of tests to run.

/fc:CoreTests
Only run test fixtures categorised as ‘CoreTests’

/fn:AdventureWorks.DatabaseTest.Tests.Sprocs.Schema
Only run test fixtures in this namespace.

/ft:AdventureWorks.DatabaseTest.Tests.Sprocs.Schema.uspGetManagerEmployees
Only run this individual test fixture.

Advertisements

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: