public virtual TestResult Run(EventListener listener, ITestFilter filter) { try { // Take note of the fact that we are running this.runThread = Thread.CurrentThread; listener.RunStarted(this.Test.TestName.FullName, test.CountTestCases(filter)); testResult = test.Run(listener, filter); // Signal that we are done listener.RunFinished(testResult); // Return result array return(testResult); } catch (Exception exception) { // Signal that we finished with an exception listener.RunFinished(exception); // Rethrow - should we do this? throw; } finally { runThread = null; } }
public TestResult Run(string test_name, EventListener listener, ITestFilter filter) { try { Type test_type = Type.GetType(test_name, true); NUnit.Core.Test test = builder.BuildFrom(test_type); TestResult result = test.Run(listener, filter); return(result); } catch (Exception ex) { Console.WriteLine("RUN EX: {0}", ex); throw; } }
public virtual TestResult Run(EventListener listener, ITestFilter filter, bool tracing, LoggingThreshold logLevel) { try { log.Debug("Starting test run"); // Take note of the fact that we are running this.runThread = Thread.CurrentThread; if (_compatibility) { Compatibility.BeginCollection(_workDirectory); TestExecutionContext.CurrentContext.CompatibilityWriter = Compatibility.Writer; } listener.RunStarted(this.Test.TestName.FullName, test.CountTestCases(filter)); testResult = test.Run(listener, filter); // Signal that we are done listener.RunFinished(testResult); log.Debug("Test run complete"); // Return result array return(testResult); } catch (Exception exception) { // Signal that we finished with an exception listener.RunFinished(exception); // Rethrow - should we do this? throw; } finally { runThread = null; if (_compatibility) { Compatibility.EndCollection(); } } }
public static void IsNotRunnable(Test test) { Assert.AreEqual(RunState.NotRunnable, test.RunState); TestResult result = test.Run(NullListener.NULL, TestFilter.Empty); Assert.AreEqual(ResultState.NotRunnable, result.ResultState); }