I put some more effort into NUnitForms yesterday and this morning. I didn't have any success. Basically nothing works, not even the samples. Obviously, there's a big hole in there somewhere that I'm just not getting. I tried pinging for help on their mailing list and the response was denial that it didn't work; end of story. The sample puts the test cases directly into the executable, which seems kinda ridiculous. I'm not going to deploy the test cases w/ my application.
I created a simple EXE that referenced one of my DLLs. I then wrote one empty test as follows.
[NUnit.Framework.TestFixture]
public CommentForm()
{
}
ss.PictureBar.CommentForm form = null;
[NUnit.Framework.SetUp]
public void SetUp()
{
form = new ss.PictureBar.CommentForm();
form.Show();
}
[NUnit.Framework.Test]
public void Test()
{
}
}
This generates the following failures from the NUnit GUI.
--TearDown
at NUnit.Extensions.Forms.NUnitFormTest.Verify()
test.Forms.CommentForm.Test :
TearDown : System.NullReferenceException : Object reference not set to an instance of an object.
I tried a thousand variations of this trivial test w/out success. Well, except the one variation where you remove the NUnitFormTest inheritance. Then it works just fine ;)
After a second failure to get anything runnig in NUnitForms, it'll be some time before I try it again.
the method setup is alread declared in the base class -- try overrideing that method, (including a call to base.Setup())
Tests executed on the hidden desktop seem to throw exceptions in the TearDown code inside NUnitForms in some circumstances. I haven't fully identified what the circumstances are. Some tests work, some don't. It may be something with modal dialogs.
The answer for the ones that don't work is not to use the hidden desktop. To do this, stick this in your test class:
public override bool UseHidden
{
get { return false; }
}
The down side is that the tests run a little more slowly, and you can't use the PC whilst they are running (you keep losing focus, and your mouse movements will steal the focus from the test windows).