locked
Unit testing WPF controls with NUnit RRS feed

  • Question

  • Hi there,

    Has anyone had experience testing WPF controls using NUnit?

    There are a few problems I've come across that seem to make it a pretty time consuming task:
    - The problems that NUnitForms tries to solve - ie. simulating a button click etc...
    - NUnit uses MTA Threads - in some cases WPF controls require STA threads. There's a 'CrossThreadRunnerHelper' solution out there that allows you to run a test in a separate thread. But this also makes things even more complex.

    Does anyone have any ideas on making this process a bit simpler? Samples/Examples would be appreciated.

    Thanks,
    Ashley

    Tuesday, August 1, 2006 1:49 PM

Answers

  • We've been using MbUnit happily for this task, which lets you put an attribute like this on a test fixture:
    [TestFixture(ApartmentState = ApartmentState.STA)]

    See http://www.mertner.com/confluence/display/MbUnit/FixtureThreadApartmentState

    Tuesday, August 1, 2006 6:37 PM

All replies

  • We've been using MbUnit happily for this task, which lets you put an attribute like this on a test fixture:
    [TestFixture(ApartmentState = ApartmentState.STA)]

    See http://www.mertner.com/confluence/display/MbUnit/FixtureThreadApartmentState

    Tuesday, August 1, 2006 6:37 PM
  • Wow...that rocks.  Does nunit have any plans for this?
    Friday, October 6, 2006 9:01 PM