public void AppDomainUnloadedBug() { TestDomain domain = new TestDomain(); domain.Load( new TestPackage( mockDll ) ); domain.Run(new NullListener(), TestFilter.Empty, false, LoggingThreshold.Off); domain.Unload(); }
public void AppDomainUnloadedBug() { TestDomain domain = new TestDomain(); domain.Load( new TestPackage( "mock-assembly.dll" ) ); domain.Run(new NullListener()); domain.Unload(); }
public void AppDomainUnloadedBug() { TestDomain domain = new TestDomain(); domain.Load( new TestPackage( mockDll ) ); domain.Run(new NullListener()); domain.Unload(); }
private static bool MakeTestFromCommandLine(TestDomain testDomain, string testDll) { ServiceManager.Services.AddService(new DomainManager()); var package = new TestPackage(testDll); return(testDomain.Load(package)); }
private Test MakeTest(TestDomain testDomain, string assemblyName) { NUnitProject project; project = NUnitProject.FromAssembly(assemblyName); return(testDomain.Load(project)); }
public void AppDomainUnloadedBug() { TestDomain domain = new TestDomain(); domain.Load(new TestPackage("mock-assembly.dll")); domain.Run(new NullListener()); domain.Unload(); }
public void AppDomainUnloadedBug() { TestDomain domain = new TestDomain(); domain.Load(new TestPackage(mockDll)); domain.Run(new NullListener()); domain.Unload(); }
public void MakeAppDomain() { TextWriter outStream = new ConsoleWriter(Console.Out); TextWriter errorStream = new ConsoleWriter(Console.Error); domain = new TestDomain(outStream, errorStream); test = domain.Load("mock-assembly.dll"); }
public void AppDomainUnloadedBug() { TestDomain domain = new TestDomain(); domain.Load(new TestPackage(mockDll)); domain.Run(new NullListener(), TestFilter.Empty, false, LoggingThreshold.Off); domain.Unload(); }
private ITest MakeTest(TestDomain testDomain, string assemblyName) { TestPackage package = new TestPackage(assemblyName); package.Settings["ShadowCopyFiles"] = false; return(testDomain.Load(package) ? testDomain.Test : null); }
private TestRunner MakeTestRunner(string strTestModuleName) { TestPackage package = new TestPackage(strTestModuleName); TestRunner testRunner = new TestDomain(); testRunner.Load(package); return(testRunner); }
public void Init() { domain = new TestDomain(); TestPackage package = new TestPackage( name ); package.Assemblies.Add( path1 ); package.Assemblies.Add( path2 ); domain.Load( package ); loadedSuite = domain.Test; }
public void ResultStillValidAfterDomainUnload() { TestPackage package = new TestPackage(mockDll); Assert.IsTrue(domain.Load(package)); TestResult result = domain.Run(new NullListener()); TestResult caseResult = findCaseResult(result); Assert.IsNotNull(caseResult); TestResultItem item = new TestResultItem(caseResult); string message = item.GetMessage(); Assert.IsNotNull(message); }
public void ResultStillValidAfterDomainUnload() { //TODO: This no longer appears to test anything TestPackage package = new TestPackage(mockDll); Assert.IsTrue(domain.Load(package)); TestResult result = domain.Run(new NullListener(), TestFilter.Empty, false, LoggingThreshold.Off); TestResult caseResult = findCaseResult(result); Assert.IsNotNull(caseResult); //TestResultItem item = new TestResultItem(caseResult); //string message = item.GetMessage(); //Assert.IsNotNull(message); }
public void ResultStillValidAfterDomainUnload() { TestPackage package = new TestPackage("mock-assembly.dll"); Assert.IsTrue(domain.Load(package)); TestResult result = domain.Run(new NullListener()); TestSuiteResult suite = result as TestSuiteResult; Assert.IsNotNull(suite); TestCaseResult caseResult = findCaseResult(suite); Assert.IsNotNull(caseResult); TestResultItem item = new TestResultItem(caseResult); string message = item.GetMessage(); Assert.IsNotNull(message); }
public static void Main(string[] args) { NUnitBridge listener = null; try { listener = new NUnitBridge(Int32.Parse(args[0])); TestDomain domain = new TestDomain(); domain.Load(args[1]); domain.Run(listener); listener.Close(); } finally { if (listener != null) { listener.Close(); } } }
public void LoadFixture() { TestDomain domain = new TestDomain(); TestPackage package = new TestPackage( "Multiple Assemblies Test" ); package.Assemblies.Add( Path.GetFullPath( "nonamespace-assembly.dll" ) ); package.Assemblies.Add( Path.GetFullPath( "mock-assembly.dll" ) ); package.TestName = "NUnit.Tests.Assemblies.MockTestFixture"; try { domain.Load(package); Assert.AreEqual(MockTestFixture.Tests, domain.Test.TestCount); } finally { domain.Unload(); } }
public TestResult Execute(string configFileName, ITestFilter filter) { if (ServiceManager.Services.GetService(typeof(DomainManager)) == null) { ServiceManager.Services.AddService(new DomainManager()); ServiceManager.Services.InitializeServices(); } var package = new NBiPackage(BinPath, configFileName); var runner = new TestDomain(); runner.Load(package); var testResult = runner.Run(new NullListener(), filter, false, LoggingThreshold.Warn); return(testResult); }
public void LoadFixture() { TestDomain domain = new TestDomain(); TestPackage package = new TestPackage("Multiple Assemblies Test"); package.Assemblies.Add(NoNamespaceTestFixture.AssemblyPath); package.Assemblies.Add(MockAssembly.AssemblyPath); package.TestName = "NUnit.Tests.Assemblies.MockTestFixture"; try { domain.Load(package); Assert.AreEqual(MockTestFixture.Tests, domain.Test.TestCount); } finally { domain.Unload(); } }
public void LoadTestsFromCompiledAssembly() { CompilerResults results = compiler.CompileCode(goodCode); Assert.AreEqual(0, results.NativeCompilerReturnValue); TestRunner runner = new TestDomain(); try { Assert.IsTrue(runner.Load(new TestPackage(outputName))); Assert.AreEqual(2, runner.Test.TestCount); } finally { runner.Unload(); } }
private static Test MakeTestFromCommandLine(TestDomain testDomain, ConsoleOptions parser) { NUnitProject project; if (parser.IsTestProject) { project = NUnitProject.LoadProject((string)parser.Parameters[0]); string configName = (string)parser.config; if (configName != null) { project.SetActiveConfig(configName); } } else { project = NUnitProject.FromAssemblies((string[])parser.Parameters.ToArray(typeof(string))); } return(testDomain.Load(project, parser.fixture)); }
public void ResultStillValidAfterDomainUnload() { TestDomain domain = new TestDomain(Console.Out, Console.Error); Test test = domain.Load("mock-assembly.dll"); Assert.IsNotNull(test); TestResult result = domain.Run(new NullListener()); TestSuiteResult suite = result as TestSuiteResult; Assert.IsNotNull(suite); TestCaseResult caseResult = findCaseResult(suite); Assert.IsNotNull(caseResult); TestResultItem item = new TestResultItem(caseResult); domain.Unload(); string message = item.GetMessage(); Assert.IsNotNull(message); }
public void DiscoverTests(IEnumerable <string> sources, IDiscoveryContext discoveryContext, IMessageLogger messageLogger, ITestCaseDiscoverySink discoverySink) { TestLog.Initialize(messageLogger); if (RegistryFailure) { TestLog.SendErrorMessage(ErrorMsg); } Info("discovering tests", "started"); // Ensure any channels registered by other adapters are unregistered CleanUpRegisteredChannels(); // var initPath = Path.Combine(Environment.CurrentDirectory, "init.tml"); var initPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "NUnitTestAdapter"); initPath = Path.Combine(initPath, "init.tml"); var blackList = new List <string>(); if (File.Exists(initPath)) { var config = Toml.ReadFile <Configuration>(initPath); blackList = config.Blacklist.Select(b => b.ToLowerInvariant()).ToList(); } foreach (string sourceAssembly in sources) { if (blackList.Contains(Path.GetFileName(sourceAssembly.ToLowerInvariant()))) { TestLog.SendDebugMessage("Ignore " + sourceAssembly); continue; } TestLog.SendDebugMessage("Processing " + sourceAssembly); //config.Blacklist.Add(sourceAssembly); TestRunner runner = new TestDomain(); var package = CreateTestPackage(sourceAssembly); TestConverter testConverter = null; try { if (runner.Load(package)) { testConverter = new TestConverter(TestLog, sourceAssembly); int cases = ProcessTestCases(runner.Test, discoverySink, testConverter); TestLog.SendDebugMessage(string.Format("Discovered {0} test cases", cases)); } else { TestLog.NUnitLoadError(sourceAssembly); } } catch (BadImageFormatException) { // we skip the native c++ binaries that we don't support. TestLog.AssemblyNotSupportedWarning(sourceAssembly); } catch (FileNotFoundException ex) { // Probably from the GetExportedTypes in NUnit.core, attempting to find an assembly, not a problem if it is not NUnit here TestLog.DependentAssemblyNotFoundWarning(ex.FileName, sourceAssembly); } catch (FileLoadException ex) { // Attempts to load an invalid assembly, or an assembly with missing dependencies TestLog.LoadingAssemblyFailedWarning(ex.FileName, sourceAssembly); } catch (UnsupportedFrameworkException ex) { TestLog.UnsupportedFrameworkWarning(sourceAssembly); } catch (Exception ex) { TestLog.SendErrorMessage("Exception thrown discovering tests in " + sourceAssembly, ex); } finally { if (testConverter != null) { testConverter.Dispose(); } runner.Unload(); } } //Toml.WriteFile(config, @"test.tml"); Info("discovering test", "finished"); }
public static void MakeAppDomain() { testDomain = new TestDomain(); testDomain.Load( new TestPackage( "mock-assembly.dll" ) ); loadedTest = testDomain.Test; }
public void LoadFixture() { TestDomain domain = new TestDomain(); TestPackage package = new TestPackage( "Multiple Assemblies Test" ); package.Assemblies.Add(NoNamespaceTestFixture.AssemblyPath); package.Assemblies.Add(MockAssembly.AssemblyPath); package.TestName = "NUnit.Tests.Assemblies.MockTestFixture"; try { domain.Load(package); Assert.AreEqual(MockTestFixture.Tests, domain.Test.TestCount); } finally { domain.Unload(); } }
public static void MakeAppDomain() { testDomain = new TestDomain(); testDomain.Load(new TestPackage(mockDll)); loadedTest = testDomain.Test; }
public void LoadAssembly() { Test test = testDomain.Load("mock-assembly.dll"); Assert.IsNotNull(test, "Test should not be null"); }
public void MakeAppDomain() { testDomain = new TestDomain(); testDomain.Load(new TestPackage("mock-assembly.dll")); loadedTest = testDomain.Test; }
public void FileNotFound() { testDomain.Load(new TestPackage("xxxx.dll")); }
public void BuildSuite() { Test suite = domain.Load(name, assemblies); Assert.IsNotNull(suite); }
public void DiscoverTests(IEnumerable <string> sources, IDiscoveryContext discoveryContext, IMessageLogger messageLogger, ITestCaseDiscoverySink discoverySink) { TestLog.Initialize(messageLogger); if (RegistryFailure) { TestLog.SendErrorMessage(ErrorMsg); } Info("discovering tests", "started"); // Ensure any channels registered by other adapters are unregistered CleanUpRegisteredChannels(); foreach (string sourceAssembly in sources) { TestLog.SendDebugMessage("Processing " + sourceAssembly); TestRunner runner = new TestDomain(); var package = CreateTestPackage(sourceAssembly); TestConverter testConverter = null; try { if (runner.Load(package)) { testConverter = new TestConverter(TestLog, sourceAssembly); int cases = ProcessTestCases(runner.Test, discoverySink, testConverter); TestLog.SendDebugMessage(string.Format("Discovered {0} test cases", cases)); } else { TestLog.NUnitLoadError(sourceAssembly); } } catch (BadImageFormatException) { // we skip the native c++ binaries that we don't support. TestLog.AssemblyNotSupportedWarning(sourceAssembly); } catch (FileNotFoundException ex) { // Probably from the GetExportedTypes in NUnit.core, attempting to find an assembly, not a problem if it is not NUnit here TestLog.DependentAssemblyNotFoundWarning(ex.FileName, sourceAssembly); } catch (FileLoadException ex) { // Attempts to load an invalid assembly, or an assembly with missing dependencies TestLog.LoadingAssemblyFailedWarning(ex.FileName, sourceAssembly); } catch (UnsupportedFrameworkException ex) { TestLog.UnsupportedFrameworkWarning(sourceAssembly); } catch (Exception ex) { TestLog.SendErrorMessage("Exception thrown discovering tests in " + sourceAssembly, ex); } finally { if (testConverter != null) { testConverter.Dispose(); } runner.Unload(); } } Info("discovering test", "finished"); }
public static void MakeAppDomain() { testDomain = new TestDomain(); testDomain.Load( new TestPackage(mockDll)); loadedTest = testDomain.Test; }