public WaitForCompletion ( int timeout ) : bool | ||
timeout | int | Time to wait in milliseconds |
리턴 | bool |
public bool Execute() { var runner = new NUnitTestAssemblyRunner(new DefaultTestAssemblyBuilder()); var currentAssembly = typeof(TestRunner).GetTypeInfo().Assembly; var options = new Dictionary<string, string>(); var tests = runner.Load(currentAssembly, options); var result = runner.Run(this, this.Filter); runner.WaitForCompletion(int.MaxValue); var success = result.FailCount == 0 && result.InconclusiveCount == 0 && result.SkipCount == 0; return success; }
private bool Execute() { try { FailedTestMethods = new List<TestMethod>(); if (!IsInternetAvailable()) { WriteInfo("Internet is not available, exiting"); return false; } WriteInfo("Setting up runner..."); var runner = new NUnitTestAssemblyRunner(new DefaultTestAssemblyBuilder()); var currentAssembly = typeof(TestRunner).GetTypeInfo().Assembly; var options = new Dictionary<string, string>(); var tests = runner.Load(currentAssembly, options); WriteInfo("Running tests..."); var result = runner.Run(this, this.Filter); runner.WaitForCompletion(int.MaxValue); var success = result.HasTestSucceeded(); WriteInfo("All tests executed"); WriteInfo("Time elapsed: {0}", TimeSpan.FromSeconds(result.Duration)); if (!success) { var failedMethodNames = FailedTestMethods.Select(tm => tm.Name).ToList(); WriteInfo("Failed methods: {0}", string.Join(", ", failedMethodNames)); } // optionally, write result as xml //WriteInfo("Test results as XML: {0}", result.ToXml(true).OuterXml); PushLog(success); return success; } catch(Exception e) { WriteError("Encountered catastrophic error during test execution: {0}", e.ToString()); return false; } }
private bool Execute() { if (!IsInternetAvailable()) { WriteInfo("Internet is not available, exiting"); return false; } WriteInfo("Setting up runner..."); var runner = new NUnitTestAssemblyRunner(new DefaultTestAssemblyBuilder()); var currentAssembly = typeof(TestRunner).GetTypeInfo().Assembly; var options = new Dictionary<string, string>(); var tests = runner.Load(currentAssembly, options); WriteInfo("Running tests..."); var result = runner.Run(this, this.Filter); runner.WaitForCompletion(int.MaxValue); var success = result.FailCount == 0 && result.InconclusiveCount == 0 && result.SkipCount == 0; WriteInfo("All tests executed"); WriteInfo("Time elapsed: {0}", TimeSpan.FromSeconds(result.Duration)); // optionally, write result as xml //WriteInfo("Test results as XML: {0}", result.ToXml(true).OuterXml); PushLog(success); return success; }