Hi Stephen,

If you're using MbUnit from TestDriven.NET then the following may be
of interest:

One difference between TestDriven.NET and the NUnit GUI is that it defaults
to using a STA thread (the same as the NUnit console) rather than a
MTA thread. You can override this behaviour by creating an App.config
with the following elements:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
      <appSettings>
              <add key="ApartmentState" value="MTA" />
      </appSettings>
</configuration>

This works with all test types, not just NUnit.

The NUnit GUI doesn't specify an ApartmentState. This leaves the test
thread in the 'Unknown' ApartmentState (which behaves like a MTA). The
problem with this is it leaves open a horrible test order dependency
problem. You could end up with half your tests running on a MTA and
the other half running STA. Or worse a test could fail when it tries
to change the ApartmentState a second time.

I chose to make TestDriven.NET behave like the NUnit console. This
uses the STAThread attribute on its Main method. The reasoning was to
avoid surprises when people checked in their tests and ran them using
something like CruiseControl.NET. It also forces consistency across
all tests in a project. Also there seems to be more code that only
works on a STA thread than the other way around (your situation). I
think allowing this .config setting it the least worst option.

Thanks, Jamie.

--
http://www.testdriven.net
http://weblogs.asp.net/nunitaddin


On 10/5/06, Stephen Cook <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm trying to migrate some tests from NUnit to MBUnit.
> The tests automate and instance of WatiN, which in turn is manipulating an
> Internet Explorer instance. As such WatiN needs to be invoked in Single
> Threaded.
>
> For NUnit I can add a section in the config to set this up.
> How do I achieve the same in MbUnit?
>
> Thanks - Steve
>  >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to