public static void SaveResult(TestResult result, Test test, string folder) { result.Locator = test.GetPath().Locator; var fileSystem = new FileSystem(); fileSystem.CreateDirectory(folder); var filename = Path.Combine(folder, FileNameFor(test)); fileSystem.PersistToFile(result, filename); }
internal TestRun(TestExecutionRequest request, IFixtureContainerSource fetchContainer, ITestObserver listener, FixtureLibrary library, SystemLifecycle lifecycle) { _request = request; _fetchContainer = fetchContainer; _listener = listener; _library = library; _lifecycle = lifecycle; _result = new TestResult(); }
internal TestRun(TestExecutionRequest request, ITestObserver listener, FixtureLibrary library, ISystem system) { _request = request; _listener = listener; _library = library; _system = system; _result = new TestResult { RetryAttemptNumber = request.Test.RetryAttemptNumber }; }
private bool shouldOpenTest(TestResult testResult) { switch (_openOption) { case (OpenHtmlOption.Always): return true; case (OpenHtmlOption.FailureOnly): return !testResult.Counts.WasSuccessful(); case (OpenHtmlOption.Never): return false; } return false; }
public void SaveResult(IProject project, Test test, TestResult result) { string folder = folderFor(project); SaveResult(result, test, folder); }
internal TestResult Execute() { _listener.StartTest(_request.Test, _result.Counts); Stopwatch timer = Stopwatch.StartNew(); try { _execution = _system.CreateContext(); } catch (Exception e) { var document = new HtmlDocument(); document.Title = "Catastrophic Failure!"; document.Add("pre").Text(e.ToString()); var result = new TestResult { Counts = new Counts(0, 0, 1, 0), ExceptionText = e.ToString(), Html = document.ToString(), Locator = _request.Test.LocatorPath(), ExecutionTime = 0, FullExceptionText = e.ToString(), WasCancelled = false, RetryAttemptNumber = _request.Test.RetryAttemptNumber }; _request.Test.LastResult = result; return result; } _context = new TestContext(_execution, _request.Test, _listener); if (_context.RetryAttemptNumber > 0) { _system.Recycle(); } _reset = new ManualResetEvent(false); try { startThread(); recordTimeout(); } catch (Exception e) { captureException(e); _listener.Exception(e.ToString()); } _testThread = null; timer.Stop(); recordResults(timer); _listener.FinishTest(_request.Test); return _result; }