Running NUnit Tests from Code

Posted by Dror Helper on Stack Overflow See other posts from Stack Overflow or by Dror Helper
Published on 2010-05-13T10:11:22Z Indexed on 2010/05/13 10:24 UTC
Read the original article Hit count: 266

Filed under:

I'm trying to write a simple method that receives a file an runs it using NUnit. The code I managed to build using NUnit's source does not work:

if(openFileDialog1.ShowDialog() != DialogResult.OK)
{
    return;
}

var builder = new TestSuiteBuilder();
var testPackage = new TestPackage(openFileDialog1.FileName);
var directoryName = Path.GetDirectoryName(openFileDialog1.FileName);
testPackage.BasePath = directoryName;
var suite = builder.Build(testPackage);

TestResult result = suite.Run(new NullListener(), TestFilter.Empty);

The problem is that I keep getting an exception thrown by builder.Build stating that the assembly was not found.

What am I missing?

© Stack Overflow or respective owner

Related posts about nunit