Adding the following line at the beginning, sets up the NUnit framework and might help you:
CoreExtensions.Host.InitializeService();
Another "easier" way to execute NUnit tests programmatically would be:
TestPackage testPackage = new TestPackage(@"C:YourProject.Tests.dll");
RemoteTestRunner remoteTestRunner = new RemoteTestRunner();
remoteTestRunner.Load(testPackage);
TestResult testResult = remoteTestRunner.Run(new NullListener());
You need to reference the following assemblies:
nunit.core.dll
nunit.core.interfaces.dll
And of course, the nunit.framework.dll
must be in the folder with your test assembly ;)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…