public void RunAssembly(IFrameworkHandle testLog) { try { #if LAUNCHDEBUGGER System.Diagnostics.Debugger.Launch(); #endif if (TryLoadAssembly()) { using (NUnitEventListener listener = new NUnitEventListener(testLog, TestConverter)) { try { runner.Run(listener, NUnitFilter, true, LoggingThreshold.Off); } catch (NullReferenceException) { // this happens during the run when CancelRun is called. logger.SendDebugMessage("Nullref caught"); } finally { runner.Unload(); } } } else { logger.NoNUnit2TestsFoundIn(assemblyName); } } catch (BadImageFormatException) { // we skip the native c++ binaries that we don't support. logger.AssemblyNotSupportedWarning(assemblyName); } catch (System.IO.FileNotFoundException ex) { // Probably from the GetExportedTypes in NUnit.core, attempting to find an assembly, not a problem if it is not NUnit here logger.DependentAssemblyNotFoundWarning(ex.FileName, assemblyName); } catch (UnsupportedFrameworkException ex) { //The UnsupportedFrameworkException is thrown by nunit, if the assembly references the NUnit v3 framework. logger.SendInformationalMessage("Attempt to load assembly with unsupported test framework in " + assemblyName); } catch (Exception ex) { logger.SendErrorMessage("Exception thrown executing tests in " + assemblyName, ex); } }
protected void Info(string method, string function) { var msg = string.Format("{0} {1} {2} is {3}", Name, adapterVersion, method, function); TestLog.SendInformationalMessage(msg); }