I've managed to narrow down the problem. [TestFixtureSetUp], [SetUp]
and [AssemblyCleanup.Setup] do get run before the [CombinatorialTest],
the problem is the startup code for the [Factory] method is run before
any setup methods.
Is there any way to fix this?
See demo:
using System;
using MbUnit.Framework;
[assembly: AssemblyCleanup(typeof(MBUnitDemo.AC))]
namespace MBUnitDemo
{
class Program {
static void Main(string[] args){
using (MbUnit.Core.AutoRunner runner = new
MbUnit.Core.AutoRunner()) {
runner.Load(); runner.Run();
runner.ReportToXml();
}}}
public static class AC
{
[SetUp]
public static void SetUp(){
Console.WriteLine("AC Setup");
}
}
[TestFixture]
public class Tests
{
[Factory(typeof(string))]
public System.Collections.IEnumerable GetSomeTestItems()
{
Console.WriteLine("In GetSomeStrings startup - this does
not show in report");
yield return "s1";
yield return "s2";
}
[TestFixtureSetUp]
public void TFSetUp()
{
Console.WriteLine("TF Setup");
}
[SetUp]
public void SetUp()
{
Console.WriteLine("Setup");
}
[CombinatorialTest]
public void CTTest([UsingFactories("GetSomeTestItems")]string
ti)
{
Console.WriteLine("Test " + ti);
}
}
}
<?xml version="1.0" encoding="utf-8" ?>
- <report-result xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
date="2006-11-29T18:15:50.8107502-05:00">
<counter duration="0" run-count="2" success-count="2"
failure-count="0" ignore-count="0" skip-count="0" assert-count="0" />
- <assemblies>
- <assembly name="UnitTests.MBUnit" full-name="UnitTests.MBUnit,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
- <set-up name="MBUnitDemo.AC.SetUp" result="success" duration="0"
memory="24576">
<console-out>AC Setup</console-out>
<console-error />
</set-up>
<counter duration="0" run-count="2" success-count="2"
failure-count="0" ignore-count="0" skip-count="0" assert-count="0" />
<version major="1" minor="0" build="0" revision="0" />
- <namespaces>
- <namespace name="MBUnitDemo">
<counter duration="0" run-count="2" success-count="2"
failure-count="0" ignore-count="0" skip-count="0" assert-count="0" />
<namespaces />
- <fixtures>
- <fixture name="Tests" type="MBUnitDemo.Tests">
- <set-up name="TestFixtureSetUp" result="success" duration="0"
memory="0">
<console-out>TF Setup</console-out>
<console-error />
</set-up>
<counter duration="0" run-count="2" success-count="2"
failure-count="0" ignore-count="0" skip-count="0" assert-count="0" />
<description />
- <runs>
- <run name="Tests.SetUp.CTTest(GetSomeTestItems(s1))" result="success"
assert-count="0" duration="0" memory="8192">
<invokers />
<warnings />
<asserts />
<Description />
<console-out>Setup Test s1</console-out>
<console-error />
</run>
- <run name="Tests.SetUp.CTTest(GetSomeTestItems(s2))" result="success"
assert-count="0" duration="0" memory="0">
<invokers />
<warnings />
<asserts />
<Description />
<console-out>Setup Test s2</console-out>
<console-error />
</run>
</runs>
</fixture>
</fixtures>
</namespace>
</namespaces>
</assembly>
</assemblies>
</report-result>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MbUnit.User" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/MbUnitUser?hl=en
-~----------~----~----~----~------~----~------~--~---