public void TestStarted(ITest test) { string startElement = test is TestSuite ? "start-suite" : "start-test"; var parent = GetParent(test); try { string report = test is TestSuite ? $"<start-suite id=\"{test.Id}\" parentId=\"{(parent != null ? parent.Id : string.Empty)}\" name=\"{FormatAttributeValue(test.Name)}\" fullname=\"{FormatAttributeValue(test.FullName)}\" type=\"{test.TestType}\"/>" : $"<start-test id=\"{test.Id}\" parentId=\"{(parent != null ? parent.Id : string.Empty)}\" name=\"{FormatAttributeValue(test.Name)}\" fullname=\"{FormatAttributeValue(test.FullName)}\" type=\"{test.TestType}\" classname=\"{FormatAttributeValue(test.ClassName ?? "")}\" methodname=\"{FormatAttributeValue(test.MethodName ?? "")}\"/>"; handler.RaiseCallbackEvent(report); } catch (Exception ex) { log.Error("Exception processing " + test.FullName + Environment.NewLine + ex.ToString()); } }
private void RunTests(ICallbackEventHandler handler, string filter) { Guard.ArgumentNotNull(filter, "filter"); ITestResult result = Runner.Run(new TestProgressReporter(handler), TestFilter.FromXml(filter)); // Ensure that the CallContext of the thread is not polluted // by our TestExecutionContext, which is not serializable. TestExecutionContext.ClearCurrentContext(); handler.RaiseCallbackEvent(result.ToXml(true).OuterXml); }
private void RunTests(ICallbackEventHandler handler, string filter) { try { ITestResult result = Runner.Run(new TestProgressReporter(handler), TestFilter.FromXml(filter)); // Ensure that the CallContext of the thread is not polluted // by our TestExecutionContext, which is not serializable. TestExecutionContext.ClearCurrentContext(); handler.RaiseCallbackEvent(result.ToXml(true).OuterXml); } catch (Exception ex) { handler.RaiseCallbackEvent(FormatErrorReport(ex)); } finally { //InternalTrace.Flush(); } }
static bool OnTestStart(ITestCommand command, ICallbackEventHandler callback) { if (callback == null) return true; XmlNode node = command.ToStartXml(); if (node != null) callback.RaiseCallbackEvent(node.OuterXml); return bool.Parse(callback.GetCallbackResult()); }
private void ExploreTests(ICallbackEventHandler handler, string filter) { Guard.ArgumentNotNull(filter, "filter"); if (Runner.LoadedTest == null) { throw new InvalidOperationException("The Explore method was called but no test has been loaded"); } // TODO: Make use of the filter handler.RaiseCallbackEvent(Runner.LoadedTest.ToXml(true).OuterXml); }
private void CountTests(ICallbackEventHandler handler, string filter) { Guard.ArgumentNotNull(filter, "filter"); if (Runner.LoadedTest == null) { throw new InvalidOperationException("The CountTests method was called but no test has been loaded"); } var count = Runner.CountTestCases(TestFilter.FromXml(filter)); handler.RaiseCallbackEvent(count.ToString()); }
///// <summary> ///// Called when a test run has just started ///// </summary> ///// <param name="test">The test that is starting</param> //public void RunStarted(ITest test) //{ // try // { // string report = string.Format( // "<start-run id=\"{0}\" name=\"{1}\" fullname=\"{2}\"/>", // test.Id, // XmlHelper.FormatAttributeValue(test.Name), // XmlHelper.FormatAttributeValue(test.FullName)); // handler.RaiseCallbackEvent(report); // } // catch (Exception ex) // { // log.Error("Exception processing " + test.FullName + NUnit.Env.NewLine + ex.ToString()); // } //} ///// <summary> ///// Called when a test has finished. Sends a result summary to the callback. ///// to ///// </summary> ///// <param name="result">The result of the test</param> //public void RunFinished(ITestResult result) //{ // try // { // handler.RaiseCallbackEvent(result.ToXml(false).OuterXml); // } // catch (Exception ex) // { // log.Error("Exception processing " + result.FullName + NUnit.Env.NewLine + ex.ToString()); // } //} ///// <summary> ///// Called when a test has just started ///// </summary> ///// <param name="test">The test that is starting</param> //public void SuiteStarted(ITest test) //{ // try // { // string report = string.Format( // "<start-suite id=\"{0}\" name=\"{1}\" fullname=\"{2}\"/>", // test.Id, // XmlHelper.FormatAttributeValue(test.Name), // XmlHelper.FormatAttributeValue(test.FullName)); // handler.RaiseCallbackEvent(report); // } // catch (Exception ex) // { // log.Error("Exception processing " + test.FullName + NUnit.Env.NewLine + ex.ToString()); // } //} ///// <summary> ///// Called when a test has finished. Sends a result summary to the callback. ///// to ///// </summary> ///// <param name="result">The result of the test</param> //public void SuiteFinished(ITestResult result) //{ // try // { // handler.RaiseCallbackEvent(result.ToXml(false).OuterXml); // } // catch (Exception ex) // { // log.Error("Exception processing " + result.FullName + NUnit.Env.NewLine + ex.ToString()); // } //} /// <summary> /// Called when a test has just started /// </summary> /// <param name="test">The test that is starting</param> public void TestStarted(ITest test) { string startElement = test is TestSuite ? "start-suite" : "start-test"; try { string report = string.Format( "<{0} id=\"{1}\" name=\"{2}\" fullname=\"{3}\"/>", startElement, test.Id, XmlHelper.FormatAttributeValue(test.Name), XmlHelper.FormatAttributeValue(test.FullName)); handler.RaiseCallbackEvent(report); } catch (Exception ex) { log.Error("Exception processing " + test.FullName + NUnit.Env.NewLine + ex.ToString()); } }
private void RunTests(ICallbackEventHandler handler, string filter) { TNode result = Runner.Run(new TestProgressReporter(handler), TestFilter.FromXml(filter)).ToXml(true); // Insert elements as first child in reverse order if (Settings != null) // Some platforms don't have settings { InsertSettingsElement(result, Settings); } InsertEnvironmentElement(result); handler.RaiseCallbackEvent(result.OuterXml); }
private void LoadTests(ICallbackEventHandler handler) { if (_testAssembly != null) { Runner.Load(_testAssembly, Settings); } else { Runner.Load(AssemblyNameOrPath, Settings); } handler.RaiseCallbackEvent(Runner.LoadedTest.ToXml(false).OuterXml); }
static bool OnTestResult(ITestResult result, ICallbackEventHandler callback) { if (callback == null) return true; XmlDocument doc = new XmlDocument(); doc.LoadXml("<foo/>"); XmlNode node = result.ToXml(doc.ChildNodes[0]); if (node != null) callback.RaiseCallbackEvent(node.OuterXml); return bool.Parse(callback.GetCallbackResult()); }
private void RunTests(ICallbackEventHandler handler, string filter) { Guard.ArgumentNotNull(filter, "filter"); TNode result = Runner.Run(new TestProgressReporter(handler), TestFilter.FromXml(filter)).ToXml(true); // Insert elements as first child in reverse order if (Settings != null) // Some platforms don't have settings { InsertSettingsElement(result, Settings); } #if !PORTABLE && !SILVERLIGHT InsertEnvironmentElement(result); #endif // Ensure that the CallContext of the thread is not polluted // by our TestExecutionContext, which is not serializable. TestExecutionContext.ClearCurrentContext(); handler.RaiseCallbackEvent(result.OuterXml); }
private void LoadTests(ICallbackEventHandler handler) { handler.RaiseCallbackEvent(LoadTests()); }
void ProcessRaiseCallbackEvent (ICallbackEventHandler target, ref string callbackEventError) { string callbackArgument = _requestValueCollection [CallbackArgumentID]; try { target.RaiseCallbackEvent (callbackArgument); } catch (Exception ex) { callbackEventError = String.Concat ("e", RuntimeHelpers.DebuggingEnabled ? ex.ToString () : ex.Message); } }
private void CountTests(ICallbackEventHandler handler, string filter) { try { var count = Runner.CountTestCases(TestFilter.FromXml(filter)); handler.RaiseCallbackEvent(count.ToString()); } catch (Exception ex) { handler.RaiseCallbackEvent(FormatErrorReport(ex)); } }
private void RunTests(ICallbackEventHandler handler, string filter) { try { ITestResult result = Runner.Run(new TestProgressReporter(handler), TestFilter.FromXml(filter)); // Ensure that the CallContext of the thread is not polluted // by our TestExecutionContext, which is not serializable. TestExecutionContext.ClearCurrentContext(); handler.RaiseCallbackEvent(result.ToXml(true).OuterXml); } catch (Exception ex) { handler.RaiseCallbackEvent(FormatErrorReport(ex)); } finally { //InternalTrace.Flush(); } }
private void ExploreTests(ICallbackEventHandler handler) { try { // TODO: Make use of the filter if (Runner.Load(AssemblyPath, Settings)) handler.RaiseCallbackEvent(Runner.LoadedTest.ToXml(true).OuterXml); else handler.RaiseCallbackEvent(FormatErrorReport("No tests were found")); } catch (Exception ex) { handler.RaiseCallbackEvent(FormatErrorReport(ex)); } }
private void CountTests(ICallbackEventHandler handler, string filter) { Guard.ArgumentNotNull(filter, "filter"); if (Runner.LoadedTest == null) throw new InvalidOperationException("The CountTests method was called but no test has been loaded"); var count = Runner.CountTestCases(TestFilter.FromXml(filter)); handler.RaiseCallbackEvent(count.ToString()); }
private void CountTests(ICallbackEventHandler handler, string filter) { handler.RaiseCallbackEvent(CountTests(filter).ToString()); }
private void CountTests(ICallbackEventHandler handler, string filter) { Guard.ArgumentNotNull(filter, "filter"); var count = Runner.CountTestCases(TestFilter.FromXml(filter)); handler.RaiseCallbackEvent(count.ToString()); }
private void RunTests(ICallbackEventHandler handler, string filter) { Guard.ArgumentNotNull(filter, "filter"); ITestResult result = Runner.Run(new TestProgressReporter(handler), TestFilter.FromXml(filter)); // Ensure that the CallContext of the thread is not polluted // by our TestExecutionContext, which is not serializable. TestExecutionContext.ClearCurrentContext(); handler.RaiseCallbackEvent(result.ToXml(true).OuterXml); }
private void LoadTests(ICallbackEventHandler handler) { if (_testAssembly != null) Runner.Load(_testAssembly, Settings); else Runner.Load(AssemblyNameOrPath, Settings); handler.RaiseCallbackEvent(Runner.LoadedTest.ToXml(false).OuterXml); }
private void LoadTests(ICallbackEventHandler handler) { Runner.Load(AssemblyPath, Settings); handler.RaiseCallbackEvent(Runner.LoadedTest.ToXml(false).OuterXml); }
private void ExploreTests(ICallbackEventHandler handler, string filter) { Guard.ArgumentNotNull(filter, "filter"); if (Runner.LoadedTest == null) throw new InvalidOperationException("The Explore method was called but no test has been loaded"); // TODO: Make use of the filter handler.RaiseCallbackEvent(Runner.LoadedTest.ToXml(true).OuterXml); }
private void RunTests(ICallbackEventHandler handler, string filter) { Guard.ArgumentNotNull(filter, "filter"); TNode result = Runner.Run(new TestProgressReporter(handler), TestFilter.FromXml(filter)).ToXml(true); // Insert elements as first child in reverse order if (Settings != null) // Some platforms don't have settings InsertSettingsElement(result, Settings); #if !PORTABLE && !SILVERLIGHT InsertEnvironmentElement(result); #endif // Ensure that the CallContext of the thread is not polluted // by our TestExecutionContext, which is not serializable. TestExecutionContext.ClearCurrentContext(); handler.RaiseCallbackEvent(result.OuterXml); }
private void ExploreTests(ICallbackEventHandler handler, string filter) { handler.RaiseCallbackEvent(ExploreTests(filter)); }
private void LoadTests(ICallbackEventHandler handler) { handler.RaiseCallbackEvent(LoadTests()); }
private void LoadTests(ICallbackEventHandler handler) { try { int count = Runner.Load(AssemblyPath, Settings) ? Runner.LoadedTest.TestCaseCount : 0; //TestExecutionContext.ClearCurrentContext(); handler.RaiseCallbackEvent(string.Format("<loaded assembly=\"{0}\" testcases=\"{1}\"/>", AssemblyPath, count)); } catch (Exception ex) { handler.RaiseCallbackEvent(FormatErrorReport(ex)); } }
private void CountTests(ICallbackEventHandler handler, string filter) { handler.RaiseCallbackEvent(CountTests(filter).ToString()); }
private void LoadTests(ICallbackEventHandler handler) { Runner.Load(AssemblyPath, Settings); handler.RaiseCallbackEvent(Runner.LoadedTest.ToXml(false).OuterXml); }