public void CreateDriver() { Console.WriteLine(ASSEMBLY_PATH); var domain = AppDomain.CreateDomain(V2_DOMAIN_NAME, null, V2_TEST_PATH, null, false); _driver = new NUnit2FrameworkDriver(domain); var settings = new Dictionary <string, object>(); PerformBasicResultChecks(_driver.Load(ASSEMBLY_PATH, settings)); }
protected override TestExecutionResults ExecuteImpl(string testModule, IEnumerable <IMemberDefinition> testsToRun, string[] arguments) { logger.Info(string.Format("Running NUnit2 executor in App domain: {0}", AppDomain.CurrentDomain.FriendlyName)); result = new TestExecutionResults(); var appDomain = AppDomain.CreateDomain("nunit2-test", null, testModule, null, false); NUnit2FrameworkDriver driver = new NUnit2FrameworkDriver(appDomain) { ID = "1" }; // Not sure why "1" but necessary var settings = new Dictionary <string, object>(); string x = driver.Load(testModule, settings); TestFilterBuilder filterBuilder = new TestFilterBuilder(); foreach (var t in testsToRun) { filterBuilder.AddTest(t.GetFullName()); } string filter = filterBuilder.GetFilter().Text; string discoveryXmlString = driver.Explore(filter); // TODO: Check if discovery information can be otained from // execution results. Not sure if execution results contain all // test methods and classes or only executed ones ParseDiscoveryResults(discoveryXmlString.ToXmlDocument()); if (testsToRun.Count() > 0) { string xmlString = driver.Run(this, filter); ParseExecutionResults(xmlString.ToXmlDocument()); } else { logger.Info("No tests selected for run"); } AppDomain.Unload(appDomain); var temp = result; // clean the local field for the next time result = null; return(temp); }