Dashboard > MbUnit > Site Index
  MbUnit Log In View a printable version of the current page.  
  Site Index
Added by Jay Flowers, last edited by Jay Flowers on Jul 02, 2005

Space Index

0-9 ... 0 A ... 8 B ... 3 C ... 10 D ... 12 E ... 3
F ... 5 G ... 2 H ... 1 I ... 3 J ... 1 K ... 0
L ... 1 M ... 9 N ... 2 O ... 2 P ... 5 Q ... 0
R ... 10 S ... 10 T ... 19 U ... 2 V ... 0 W ... 1
X ... 1 Y ... 1 Z ... 0 !@#$ ... 0    



Add warning in your tests to highlight problems in the report. Sometimes, a unit test does not fail but does not succeed entirely: making it fail is too extreme and on the other hand, letting him succeed would make you miss the issue. Therefore ...
Advanced Features
AssemblyDependencies CustomAssemblyResolver FixtureDependencies Reflector
Lead on the MbUnit project, you can find my blog at http://weblogs.asp.net/astopford
Provides methods to assert arrays Methods:  AreEqual(expected, actual) Browse source code http://www.mertner.com/fisheye/browse/MbUnit/mbunit/MbUnit.Framework/ArrayAssert.cs?r=root: for this class
MbUnit defines the AssemblyCleanUpAttribute that can be used to define guard methods that will act at the assembly level. Typically, highly time consuming resources can be initialized and cleaned up using those methods. Rationale The user provides a class containing static methods ...
Following the idea of FixtureDependencies, AssemblyDependencies can be defined as well: execute tests from child assembly only if tests of parent assemblies were successful. Use the AssemblyDependsOnAttribute to specify the parent assemblies: assembly: MbUnit.Core.Framework.AssemblyDependsOn("AnotherAssembly
Contains static methods for the most common assertions Method Description \\ NUnit \\ AreEqual \\ Verifies that two values are equal y AreNotEqual Verifies that two values are not equal y AreSame Asserts that two objects refer to the same object y AreNotSame ...
AssertClass (NUnit\compatible), SpecializedAssertionsClasses ArrayAssert, CollectionAssert, CompilerAssert, ControlAssert, FileAssert, PerfAssert, ReflectionAssert, SecurityAssert, StringAssert, etc


Developer blog = http:// blog dot benhall dot me dot uk
Build Server
where the build server config and all its scripts and what not should be documented. MbUnit's build server using CCNET is hosted at http://build.mutantdesign.co.uk/ccnet. Build User Info
Build Submission
Proposal Introduction As the heading above states this is a proposal. This proposal will cover how a developer should submit to the build. I have not worked on an open source project before, nor do I understand how other open source project's ...


Coding Standards
Standards ## Idioms ### .NET Exception Handling Exception handling in .NET does not follow all the rules the way you might expect. A try catch block is basically a case statement checking for what exception type was thrown. The only reason to catch ...
Contains methods to verify objects implementing the ICollection interface Methods: Method Description \\ NUnit\\ AreCountEqual verifies that the Count property values of the expected and actual collections are equal AreElementsEqual verifies that the expected and actual collections are equal (comparing item count and individual ...
TestFixture supports combinatorial tests through the use of the CombinatorialTestAttribute. A simple example Suppose that we have a ICountX interface that defines a method that counts the number of 'x' in a string: public interface ICountX You have two classes that implement that interface: class ...
Contains methods to verify that code compiles Method Description \\ Compiles \\ Verifies that the code compiles using the specified compiler\\ DisplayErrors \\ Write any compilation errors to the specified TextWriter\\ NotCompiles \\ Verifies that the code does not compile using the specified compiler\\ CSharpCompiler ...
MbUnit can load unit test that are targeted to be executed as console application: public class Program { static int Main(string args) } Supported Main signature With or without string as argument, With or without int returned. public or private Main, but always ...
Describes ConsoleTester, a helper class that tests external process. Description When you need to test a console application, this task usually involves calling the application using Process.Start and monitoring that process. The helper class ConsoleTester (located in MbUnit.Core.Framework) is there to simplify this. it redirects ...
UsingMbUnitInCruiseControlNet UsingMbUnitInDraco
Contains assertion methods to test Windows Forms controls
I'll assume that you already have a solution. First let's create a project to hold some unit test fixtures. For this example we will create a new C# Class Library Project. !CreatingAnEmptyMbUnitProject1.jpg! After the project has be added we need ...
Resolving assemblies can be a tricky business. MbUnit has a complex support for this but it is not always sufficient. In order to give full flexibility, one can define a assembly resolver type that will be used by MbUnit to resolve assemblies (as well as the default behavior). There are 2 stops ...


Contains methods to verify DataSetrelated objects. Method Description \\ AreDataEqual Compare the data in two DataSet objects\\ AreEqual Compare two DataSets, DataRows, DataColumns or DateTime objects \\ AreSchemasEqual Compare the schemas of two DataSet objects
DataFixture XmlDataProvider("../../sample.xml","//User") XmlDataProvider("../../sample.xml","DataFixture/Customers") public class DataDrivenTests { ForEachTest("User") public void ForEachTest(XmlNode node) ForEachTest("User", DataType = typeof(User)) public void ForEachTestWithSerialization(User user) } The file sample.xml ...
Design Standards
Good Design Practices # Test First This is the practice of writing unit tests before writing production code. What is a unit test? Where can I find how to do this? # Payback on Code Debt As a project progresses life happens and shortcuts ...
AndrewStopford BenHall JeffBrown MarcStober JohanAppelgren GrahamHay JoeyCalisay With contributions from JamieCansdale jflowers With support from peli
Your Environment Development Standards Patch Submission Build Submission Build Server Release There are several efforts in the MbUnit Project: MbUnit core team MbUnit GUI team MbUnit exe team SCM team (taking charge of CVS and CCNet ...
Development Standards
Design Standards Coding Standards Metrics Standards Application
GettingStarted Fixtures SetupAndTeardown TestDecorators Assertions TestExecution Dynamic Tests Useful Tools Reports ContinuousIntegration Advanced Features Other Framework Support TestFu GettingStarted CreatingAnEmptyMbUnitProject TestConfigurationFiles RunningMbUnitWithDotNetFramework11 Fixtures TestFixture TestAttribute, classic test case RepeatTestAttribute, simple ...
you want to download the entire content of the wiki, Confluence has a built support for exporting PDF. Just click on the Export button and it will generate the PDF for you
Releases MbUnit 2.4 @ Googlecode http://mbunit.googlecode.com/files/MbUnit2.4.197.exe TestDriven.NET bundle MbUnit is no longer packaged with the TD.net bundle, you can download MbUnit from the links provided below. Latest bits The latest installer: http://www.mbunit.com/downloads.aspx Source ...
Drag and drop Unit Testing(3): Performance Counter monitoring,guid,bf5b7a35ab4a43958e6b6a8d8d563ca3.aspxdraganddropunittesting&hl;=en≷=uk&ct;=clnk&cd;=3 Drag and Drop Unit Tests (2): ExceptedException, SetUp, TearDown, etc ...
DurationAttribute is a TestDecorator that verifies that the method call duration is below a given value. TestFixture public class DurationAttributeTest { Test Duration(1,"This method succeeds (has 1 second to succeed)") public void EmptyMethod() {} Test Duration(0,"This method will fail ...
Dynamic Tests
Dynamic (runtime) definition of TestSuite (see also TestSuiteFixture) ExtendibleTestSuiteFramework, add your own TestSuite easily


ExpectedExceptionAttribute is a TestDecorator that enables you to create negative tests, i.e. tests that check that your application fails the way it should. Use this CustomAttribute to tag a test with the expected exception type: Test ExpectedException(typeof(MyCustomException)) public void NegativeTest() A classical ...
Tests can be marked as explicit using the ExplicitAttribute. They will not be run unless explicitly selected, either using the GUI or command line arguments. Test, Explicit public void ExplicitTest() An entire fixture can also be marked as explicit
MbUnit supports a system of DynamicProxy that can be attached to tests. Such 'strange thing' is also called a TestDecorator because it "decorates" the way the test is executed. The most famous example of test decorated is ExpectedExceptionAttribute which verifies that a method throws the right exception. Different ...


Methods to compare files Method Description \\ AreEqual \\ AreStreamContentEqual\\ Exists\\ NotExists
MbUnit supports setting dependencies between fixtures, similarly to NAnt/MsBuild task dependencies: if a test in a parent fixture fails, the child fixture are simply not executed. Howto The logic is simple. You can tag a fixture with the DependsOnAttribute to specify a parent fixture ...
TestFixture TestAttribute, classic test case RowTestAttribute, tablebased testing CombinatorialTestAttribute, pairwise testing ExtendingTestFixtureWithYourOwnTest, extend test fixture with your own test logic ConsoleLikeFixture DataFixture DragAndDropFixture NakedFixture ProcessTestFixture TestSequenceAttribute, executes tests in a specified sequence TestSuiteFixture ...
MbUnit fixture runs in it's own thread. By default, it uses the same AppartmentState as the main thread. If you want to force using another value, you can use the AppartmentState field in the constructor: // A fixture running in STA TestFixture(ApartmentState = ApartmentState.STA) public ...
MbUnit fixtures have a default time out set to 10 minutes. Time outs are there to ensure that a test does not block the entire test process. For example, a test that pops up a dialog window requiring manual interaction would kill the entire ...


Methods to check collections that implement the generic ICollection interface. Method Description \\ IsEmpty Assert that the collection does not contain any items \\ IsNotEmpty \\ Assert that the collection contains at least one item \\ Notes  This class is included in the MbUnit.Framework.2.0 assembly
CreatingAnEmptyMbUnitProject TestConfigurationFiles RunningMbUnitWithDotNetFramework11




Tests can be marked as ignored using the IgnoreAttribute. Test Ignore("The reason why you ignore the test") public void NastyTest() An entire fixture can also be marked as ignored
interface for test cases to be added to a TestSuite. Current implementations: TestCase MethodTestCase PerformanceCounterCheckerTestCase VerifiedTestCase ExpectedExceptionTestCase


Author of the TestDriven.NET http://www.testdriven.net Addin



License Copyright © 20052007 Andrew Stopford Portions Copyright © 20002004 Jonathan De Halleux, Jamie Cansdale This software is provided 'asis', without any express or implied warranty. In no event will the authors be held liable for any damages arising from ...


Describes how you can setup Manual Tests in MbUnit. When you have given up and have no other choice, you can always count on the prehistorical "manual tests". Certainly, manual tests are not the best solution and you should ...
Provider of moral support to the project, oh, and actual code once in a blue moon.:D More info and blog at http://www.marcstober.com. http://www.marcstober.com
See Overview
MbUnit Home
MbUnitBanner.png! Downloads Documentation Support Development Site Index MbUnit is an extensible unit testing framework originally developed by Peli and JamieCansdale. Now an opensource project under the leadership of AndrewStopford. Check the growing list of MbUnit Users. Overview ...
MbUnit Users
Folks using MbUnit SAS Institute http://www.sas.com The Health Care Practice Area of Northrop Grumman Danish Institute of Technology American Idol Underground http://www.idolunderground.com Insight Direct, Inc. http://www.insightdirect.com Opensource Projects http://www.icsharpcode.net ...
MbUnit is a UnitTestFramework for the .Net platform written in C#. CustomAttribute based In MbUnit, fixture and tests are defined by tagging classes and methods with CustomAttribute. This technique was introduced by NUnit and has been considerably extended by MbUnit. Extensible MbUnit has been designed to integrate ...
Object Oriented Metrics The metrics detailed here proviode guidence on knowing what actions could be taken when thresholds are broken. Each subject being measured has its own curcumstances that effect what actions should or should not be taken ...
Allows running a test using multiple cultures IgnoreAttribute. Test MultipleCulture("enUS,itIT,enNZ") public void SomeTest() Pass in the cultures using a comma separated list
MbUnit uses custom attributes (as in NUnit) to mark types that contain tests and mark methods as tests. A type tagged with the TestFixtureAttribute can contain an arbitrary number of test methods. Each method is detected by MbUnit and transformed into a test. Creating your ...


NakedFixture is an attributefree way of defining test fixtures in MbUnit. MbUnit has a basic support for loading fixture and tests based on their names, i.e. naked fixtures . Although this may look like a step backward in functionality, this can be handy in particular ...


Other Framework Support
NUnitSupport (without recompilation) csUnitSupport (without recompilation
MbUnit is an advanced unit testing framework. peli origonally wrote this framework and posted to The Code Project http://www.codeproject.com/ in the article MbUnit : Generative Unit Test Framework http://www.codeproject.com/gen/design/gunit.asp. Peli joined Microsoft in early ...


Patch Submission
where how to submit a patch should be documented. Currently, the only text on patch submission is located in the SVN Accounts section
Jonathan 'Peli' de Halleux, is the original author of the MbUnit framework. After working 2 years in the CLR in Redmond, WA, Peli moved to the Foundations for Software Engineering group in Microsoft Research.Peli is currently developing a new test tool, Pex  ...
Contains a method for verifying performance Method Description \\ Duration\\ Creates a countdown timer that will assert if execution time exceeds maximum duration
PerfCounterAttribute is a TestDecorator that allows you assert on the values of PerformanceCounters. This means that you can make an assertion an every perfomance counter on your machine! Here's a sample fixture that shows how the attribute can be used: using System; using ...
ProcessTestFixture allows you to write tests in MbUnit that are executed in a defined sequence. Tests are then decorated with the TestSequenceAttribute to indicate the order in which they will be executed. ProcessTestFixture example: ProcessTestFixture public class CheckTestSequences { int i = 0; Test TestSequence( 2 ) public void ...



Contains methods that can verify details about classes using reflection Method Description \\ HasConstructor \\ Verifies that a class has a contructor that takes the specified parameters \\ HasDefaultConstructor\\ Verifies that a class has a default constructor \\ HasField \\ Verifies that a class has a specified ...
you have a SampleClass with a private field, property and method: public class SampleClass { private string privateStringField = "Test"; private string PrivateStringProperty { get } private int PrivateMethod(int x, int y) } then here's how you would test ...
where how to perform a release should be documented
v2.4.1 it is recommended that you use the RepeatTestAttribute instead, this ensures your SetUp & TearDown methods are run with every repetition. The RepeatAttribute is a TestDecorator that causes the test method to be repeatedly invoked. The following samples calls the method 10 times before returning. Test ...
direct replacement for the RepeatAttribute, that ensures that SetUp and TearDown methods are run with every repetition. RepeatTest(5) public void RepeatedTest() Note the repetition is sequential, as it is executed in a single thread
Description of the report support in MbUnit MbUnit has a builtin support for test results. All results can be serialized to Xml (XmlReport), Html (HtmlReport), text (TextReport) or doxyfied (DoxReport). Since report serialization is built using XmlSerialization, you can ...
ReportOverview AddingWarningsInTests XmlReport, HtmlReport, TextReport, DoxReport
feature is based on an a concept by Roy Osherove http://weblogs.asp.net/rosherove/archive/2004/07/20/187863.aspx, you can see Peli's original post on this here;=en≷=il&ct;=clnk&cd;=1 ...
new functionality enables you to specify a tabular list of test cases that are to be fed to the test method. Let us illustrate this with the floating point division testing (as in the FIT framework Simple Example ): numerator denominator quotient 1000 10 100.0000 \1000 ...
MbUnit is compiled against .Net 1.0 and will generaly use this framework version. To change this behavior, you need to insert a '''startup''' section in each of the config files :


Contains methods to verify the current authentication state Method Description \\ IsAuthenticated \\ Verify that the identity's IsAuthenticated property is true\\ IsNotAuthenticated\\ Verify that the identity's IsAuthenticated property is false \\ WindowsIsAuthenticated\\ Verify that the current Windows identity's IsAuthenticated property is true WindowsIsNotAuthenticated\\ Verify ...
Contains methods to assert serialization Method \\ Description \\ IsXmlSerializable \\ Verifies that the type is serializable by the XmlSerializer \\ TwoWaySerialization \\ Serializes and deserialies to/from XML and checks that the results are the same OneWaySerialization \\ Performs XML serialization on an object and returns the resulting XML as a string
SetUpAndTearDownOverview, overview of the setup and teardown posibilities, SetUpAndTearDownAttributes, Test level, TestFixtureSetUpTearDownAttributes, Fixture level, AssemblyCleanupAttributes, Assembly level
All fixture in MbUnit generally support a setup method tagged with SetUpAttribute, which is called once before each test, and teardown method tagged with TearDownAttribute, which is called once after each test. TestFixture public class SampleFixture { private ...
MbUnit lets you define setup and teardown methods (also named GuardMethods) at 3 levels: Level Attribute Assembly AssemblyCleanUpAttributes Fixture (per class) TestFixtureSetUpTearDownAttributes Test (per test method) SetUpAndTearDownAttributes
Site Index
Standards Application
Putting it All Together There are a lot principles, practices and values to adher to. At times they may be difficult to reconcile. The referenced sources as well as a design lead will be able to help achive harmony. Design Patterns follow these standards and are good examples how to apply them ...
Contains methods to assert strings Method Description \\ AreEqualIgnoreCase \\ Verify that two strings are equal, ignoring case differences \\ Contains \\ Verify that a string contains another string\\ DoesNotContain \\ Verify that a string does not contain another string \\ EndsWith \\ Verify that a string ...
MbUnit is not a commercial piece of software, so we cannot guarantee support. However, we do have some ways to help you with issues you may have: Issue Tracking: http://www.mertner.com/jira Mailing lists: MbUnit.Users: mailto ...
SVN Accounts
Subversion Accounts To download MbUnit source from SVN you can download using anonymous access or as a registered user. In all cases please create an account on MbUnit's Jira http://www.mertner.com/jira. Anonymous See http://code.google.com ...


canonical unit test in MbUnit The TestAttribute is used in the TestFixture to specify a single unit test. The method tagged by this attribute will be extracted by the framework and executed as a test. TestFixture public class Fixture { Test public void Test1() Test public void Test2 ...
Each test assembly can have a separate config file. MbUnit will setup the AppDomain to use the separate config file. The naming convention is as usual: Assembly name '.config' MyTestAssembly.dll > MyTestAssembly.dll.config Example: The following test illustrate the use of config files ...
When you are tagging a method with ExpectedExceptionAttribute, you are actually "decorating it" with a wrapper that will intercept exceptions and check that they are of the right type. Test ExpectedException(typeof(ArgumentNullException)) public void Test() The ExceptedExceptionAttribute acts as a DynamicProxy around the Test invokation, doing some pre ...
TestDecoratorOverview, what are decorators and how do they work, CombinatorialTestAttribute, pairwise testing, DenyPermissionAttributes, use System.Security permission to deny access to file IO, sql client, etc... DurationAttribute, asserts test duration, ExpectedExceptionAttribute, asserts on throw exception, ExplicitAttribute, ignores ...
TestExecutionUsingConsoleApplication, TestExecutionUsingNAnt, TestExecutionUsingMSBuild, TestExecutionUsingSelfExecutableTestAssemblies, TestExecutionUsingTestDriven, TestExecutionUsingWinFormsApplication
MbUnit ships with a console appliction (MbUnit.Cons.exe) that can execute test assemblies. To access the console builtin help, type MbUnit.Cons.exe or MbUnit.Cons.exe /? or MbUnit.Cons.exe /help and the following should appear: MbUnit xxxxx Console Application /reportfolder: short form /rf ...
Executes tests in a MsBuild task. !! How to use the task ? In order to use the MbUnit task in one of your MsBuild task, you need to add a UsingTask node to the project that specifies the task name and assembly location: TestExecutionUsingNAnt
Executes tests in a NAnt 0.85 task. How to use the task ? In order to use the MbUnit task in one of your NAnt projects, you need to copy the MbUnit assemblies to the NAnt bin folder (MbUnit.Tasks.dll contains the NAnt task but relies on other ...
Shows how to make a MbUnit assembly execute his own tests. The following snippet can be inserted in the Main function of a console assembly in order to make a assembly selftestable. using System; using MbUnit.Core; ... static int Main(string args ...
quick howto on setting up a MbUnit fixture and running it with TestDriven.NET. In this page, we will show how to create a new test project, set it up for MbUnit and use TestDriven.NET to the tests it contains. Step 1: Create a new assembly (preferably a console ...
MbUnit.Gui is a graphical interface to load and execute tests. Command line arguments MbUnit supports a limited number of arguments (mainly for testing purposes). @files, test assembly names /run or /r, run loaded assemblies /stop /s, closes application when ...
mainstream classic test fixture. The TestFixture fixture is an implementation of the class unit test fixture. This fixture defines as a collection of test cases (method tagged with TestAttribute), row tests (RowTestAttribute) or combinatorial test cases (CombinatorialTestAttribute). Examples MyFirstTestFixtureTutorial
All MbUnit fixtures support initialization (TestFixtureSetUpAttribute) and cleanup (TestFixtureTearDownAttribute) at the fixture level. This is particularly useful to setup and teardown time consuming resources. Rationale Supported by all fixture types Only 1 TestFixtureSetUp (resp. TestFixtureTearDown) method is allowed per ...
DatabasePopulatorFramework, helper classes for DatabaseTesting, ProductionGrammarFramework, test generators, GesturesFramework, simulate mouse and keyboard interaction using Win32 API
TestSequenceAttribute allows you to indicate the order in which tests will be executed within a test class decorated with the ProcessTestFixture attribute. Note that TestSequenceAttribute will not work on classes decorated with any other test fixture attribute. TestSequenceAttribute example: ProcessTestFixture public class CheckTestSequences ...
See TestSuiteFixture
TestSuite is a fixture populated at runtime, a dynamic fixture. A TestSuite can be filled with any number of TestCases, a good example of a TestSuite application is DataDrivenTesting where you want to create a TestCase for each data entry. Howto To use suites, tag your ...
ThreadedRepeatAttribute is a TestDecorator that causes the test method to be invoked in multiple concurent threads. The following samples calls 10 times the method before returning. Test ThreadedRepeatAttribute (10) public void NastyTest() Note that if you are looking for sequential exection, RepeatAttribute should ...
TypeFixture lets you write a fixture for specific type and apply to a number of instance of this type.This fixture is particularly useful for writing fixtures of interfaces and apply it to all the types that implement the interface. In this tutorial, we are going to write a fixture for the IEnumerable interface (note ...


Useful Tools
ManualTester, manual testing (when you haven given up) ConsoleTester, specialized class for launching external process
following information explains how to show mbUnit reports in the CruiseControl for .NET web dashboard. There are two ways you can run MbUnit with CCNet, use a plugin as described below (edited to reflect the fact the XSL is now included in the CCNet distro ...



Contains methods to verify web form pages and controls Method Description \\ AreClientTargetEqual \\ AreErrorPageEqual \\ AreTemplateSourceDirectoryEqual \\ HasControls \\ \\ HasNoControls \\ IsChild \\ IsEnableViewState \\ IsIDEqual IsNotChild \\ IsNotEnableViewState \\ IsNotPostBack \\ IsNotSmartNavigation \\ IsNotValid \\ IsNotVisible \\ IsPostBack \\ IsSmartNavigation \\ IsValid \\ IsVisible


Contains methods to verify XML Method Description \\ XmlEquals \\ XmlIdentical \\ XmlNotEquals \\ XmlNotIdentical \\ XmlValid \\ XPathEvaluatesTo \\ XPathExists \\ XlsTransofrmResults


Your Environment
Notes Where indicated versions of MbUnit must be noted as requirements have changed between versions 2.3 and 2.4. System Requirements (2.3) NET Framework version 1.0 http://www.microsoft.com/downloads/details.aspx?familyid=4fe5bdb5c7a7450599272213868a325b&displaylang;=en ...



Site powered by a free Open Source Project / Non-profit License (more) of Confluence - the Enterprise wiki.
Learn more or evaluate Confluence for your organisation.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.2.9 Build:#527 Sep 07, 2006) - Bug/feature request - Contact Administrators