Process Test Pattern fixture.
Namespace: MbUnit.Framework
Assembly: MbUnit.Framework (in MbUnit.Framework.dll)
Syntax
| C# | Visual Basic | Visual C++ |
[AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] public sealed class ProcessTestFixtureAttribute : TestFixturePatternAttribute
<AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple := False, Inherited := True)> _ Public NotInheritable Class ProcessTestFixtureAttribute _ Inherits TestFixturePatternAttribute
[AttributeUsageAttribute(AttributeTargets::Class, AllowMultiple = false, Inherited = true)] public ref class ProcessTestFixtureAttribute sealed : public TestFixturePatternAttribute
Members
| All Members | Constructors | Properties | Methods | Explicit Interface Implementations |
| Member | Description | |
|---|---|---|
| ProcessTestFixtureAttribute()()() |
Initialize a ProcessTestFixtureAttribute
instance.
| |
| ProcessTestFixtureAttribute(String) |
Constructor with a fixture description
| |
| ApartmentState | (Inherited from TestFixturePatternAttribute.) | |
| Description | (Inherited from PatternAttribute.) | |
| Equals(Object) | Returns a value that indicates whether this instance is equal to a specified object. (Inherited from Attribute.) | |
| Finalize()()() | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) | |
| GetHashCode()()() | Returns the hash code for this instance. (Inherited from Attribute.) | |
| _Attribute..::.GetIDsOfNames(Guid%, IntPtr, UInt32, UInt32, IntPtr) | (Inherited from Attribute.) | |
| GetRun()()() |
Creates the execution logic
(Overrides TestFixturePatternAttribute..::.GetRun()()().) | |
| GetTimeOut()()() | (Inherited from TestFixturePatternAttribute.) | |
| GetType()()() | Gets the Type of the current instance. (Inherited from Object.) | |
| _Attribute..::.GetTypeInfo(UInt32, UInt32, IntPtr) | (Inherited from Attribute.) | |
| _Attribute..::.GetTypeInfoCount(UInt32%) | (Inherited from Attribute.) | |
| _Attribute..::.Invoke(UInt32, Guid%, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) | (Inherited from Attribute.) | |
| IsDefaultAttribute()()() | When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class. (Inherited from Attribute.) | |
| Match(Object) | When overridden in a derived class, returns a value that indicates whether this instance equals a specified object. (Inherited from Attribute.) | |
| MemberwiseClone()()() | Creates a shallow copy of the current Object. (Inherited from Object.) | |
| TimeOut |
Gets or sets the fixture timeout in minutes.
(Inherited from TestFixturePatternAttribute.) | |
| ToString()()() | (Inherited from Object.) | |
| TypeId | When implemented in a derived class, gets a unique identifier for this Attribute. (Inherited from Attribute.) |
Remarks
Implements: Process Test Fixture
Logic:
[SetUp]
{TestSequence}
[TearDown]
| |
This fixture implements the Process Test Fixture as described in the CodeProject article from Marc Clifton.
In this implementation, reverse traversal is not implemented. A process can be seen as a linear graph, a very simple model. If you need more evolved models, use Model Based Testing.
Examples
This is the example for the CodeProject article adapted to MbUnit.
[ProcessTestFixture]
public class POSequenceTest
{
...
[TestSequence(1)]
public void POConstructor()
{
po=new PurchaseOrder();
Assert.AreEqual(po.Number,"", "Number not initialized.");
Assert.AreEqual(po.PartCount,0, "PartCount not initialized.");
Assert.AreEqual(po.ChargeCount,0, "ChargeCount not initialized.");
Assert.AreEqual(po.Invoice,null, "Invoice not initialized.");
Assert.AreEqual(po.Vendor,null, "Vendor not initialized.");
}
[TestSequence(2)]
public void VendorConstructor()
{
vendor=new Vendor();
Assert.AreEqual(vendor.Name,"", "Name is not an empty string.");
Assert.AreEqual(vendor.PartCount,0, "PartCount is not zero.");
}
...
| |
Use ProcessTestFixtureAttribute to mark a class as process test fixture and use the TestSequenceAttribute attribute to create the order of the process. The fixture also supports SetUp and TearDown methods.
Inheritance Hierarchy
System..::.Object
System..::.Attribute
MbUnit.Core.Framework..::.PatternAttribute
MbUnit.Core.Framework..::.TestFixturePatternAttribute
MbUnit.Framework..::.ProcessTestFixtureAttribute
System..::.Attribute
MbUnit.Core.Framework..::.PatternAttribute
MbUnit.Core.Framework..::.TestFixturePatternAttribute
MbUnit.Framework..::.ProcessTestFixtureAttribute
See Also
MbUnit.Framework Namespace