public override void VisitRun(ReportRun run) { string pretty = dox.Pretifier.PretifyTest(run.Name); writer.WriteLine("{0} - {1}", this.tab, pretty); base.VisitRun(run); }
private void DisplaySelectedNodeResult() { this.textBox.Text = ""; UnitTreeNode node = this.tree.TypeTree.SelectedNode as UnitTreeNode; if (node == null) { return; } ReportRun result = this.tree.TestDomains.GetResult(node); if (result != null) { switch (this.consoleStream) { case ConsoleStream.Out: this.textBox.Text = result.ConsoleOut; break; case ConsoleStream.Error: this.textBox.Text = result.ConsoleError; break; } } this.Refresh(); }
private void HandleTestFinish(RunPipe runPipe, ReportRun reportRun) { ITestCommand runPipeTestCommand; if (runPipeTestCommands.TryGetValue(runPipe, out runPipeTestCommand)) { ITestContext testContext = activeTestContexts[runPipeTestCommand]; activeTestContexts.Remove(runPipeTestCommand); // Output all execution log contents. // Note: ReportRun.Asserts is not actually populated by MbUnit so we ignore it. if (reportRun.ConsoleOut.Length != 0) { testContext.LogWriter.ConsoleOutput.Write(reportRun.ConsoleOut); } if (reportRun.ConsoleError.Length != 0) { testContext.LogWriter.ConsoleError.Write(reportRun.ConsoleError); } foreach (ReportWarning warning in reportRun.Warnings) { testContext.LogWriter.Warnings.WriteLine(warning.Text); } if (reportRun.Exception != null) { testContext.LogWriter.Failures.WriteException(GetExceptionDataFromReportException(reportRun.Exception), "Exception"); } // Finish up... testContext.AddAssertCount(reportRun.AssertCount); FinishStepWithReportRunResult(testContext, reportRun.Result); } progressMonitor.Worked(workUnit); }
void IReportsRepository.CreateReportRun(ReportRun reportRun) { using (var dc = CreateContext()) { dc.SentReportEntities.InsertOnSubmit(reportRun.Map()); dc.SubmitChanges(); } }
/// <summary> /// Default constructor - initializes all fields to default values /// </summary> public RunPipeResultEventArgs(RunPipe pipe, ReportRun result) : base(pipe) { if (result == null) { throw new ArgumentNullException("result"); } this.result = result; }
private int SendReports(IEnumerable <EmployerReport> reports, DateTime startDate, DateTime endDate) { const string method = "SendReports"; var allEmails = new List <TemplateEmail>(); // Generate the emails for all reports. foreach (var definition in reports) { try { var organisation = (VerifiedOrganisation)_organisationsQuery.GetOrganisation(definition.ClientId); var accountManager = _administratorsQuery.GetAdministrator(organisation.AccountManagerId); var reportEmails = RunReport(definition, organisation, startDate, endDate, accountManager); allEmails.AddRange(reportEmails.Where(r => r != null)); } catch (Exception ex) { EventSource.Raise(Event.Error, method, string.Format("Failed to send report of type '{0}' (definition ID = {1})", definition.Type, definition.Id), ex, new StandardErrorHandler()); } } // Combine multiple emails to the same receipients into one. var groupedEmails = CombineReports(allEmails); // Send the emails foreach (var email in groupedEmails) { _emailsCommand.TrySend(email); } DateTime sentTime = DateTime.Now; // Record that the reports were sent. foreach (var definition in reports) { // Rather than duplicate the logic which determines whether an email should have been sent // to the client or account manager here look through the emails collection to find it. var clientEmailAddress = (definition.SendToClient ? FindClientEmailAddress(allEmails, definition) : null); var accountManager = (definition.SendToAccountManager ? FindAccountManager(allEmails, definition) : null); if (clientEmailAddress != null || accountManager != null) { var sent = new ReportRun { ReportId = definition.Id, SentTime = sentTime, PeriodStart = startDate, PeriodEnd = endDate, SentToAccountManagerId = accountManager == null ? (Guid?)null : accountManager.Id, SentToClientEmail = clientEmailAddress }; _employerReportsCommand.CreateReportRun(sent); } } return(groupedEmails.Count); }
private bool ShouldSelectConnection(TfsKnownConnection knownConn, ReportRun lastReportRun) { if (lastReportRun == null) { return(false); } var select = knownConn.Id == lastReportRun.ConnectionId; return(select); }
public void Skip(Exception ex) { if (ex == null) { throw new ArgumentNullException("ex"); } this.Start(); this.result = ReportRun.Skip(this.Pipe, ex); this.Skip(); }
public override bool Filter(RunPipe pipe) { ReportRun run = this.Explorer.GetRunByName(pipe.Name); if (run == null) { return(false); } return(run.Result != ReportRunResult.Success); }
public static SentReportEntity Map(this ReportRun reportRun) { return(new SentReportEntity { id = reportRun.Id, reportDefinitionId = reportRun.ReportId, sentTime = reportRun.SentTime, periodStart = reportRun.PeriodStart, periodEnd = reportRun.PeriodEnd, sentToAccountManagerId = reportRun.SentToAccountManagerId, sentToClientEmail = reportRun.SentToClientEmail, }); }
public async Task Record(Guid knownConnId, string project, string iteration) { var filename = await GetFilename(); var run = new ReportRun { ConnectionId = knownConnId, Project = project, Iteration = iteration, }; var json = JsonConvert.SerializeObject(run); await File.WriteAllTextAsync(filename, json); }
void TestEngineIgnore(ReportRun run) { this.ignoreCount++; TestResult summary = new TestResult(); summary.State = TDF.TestState.Ignored; summary.TotalTests = this.testCount; summary.Name = run.Name; summary.TimeSpan = new TimeSpan(0, 0, 0, 0, (int)(run.Duration * 1000)); testListener.WriteLine(String.Format("[ignored] {0}", run.Name), Category.Info); this.testListener.TestFinished(summary); }
public void Fail(ReportMonitor monitor, Exception ex) { if (monitor == null) { throw new ArgumentNullException("monitor"); } if (ex == null) { throw new ArgumentNullException("ex"); } this.Start(); this.result = ReportRun.Failure(this.Pipe, monitor, ex); this.Failure(); }
private void DisplaySelectedNodeResult() { // retreive current exceptoin this.exceptionTreeView.Nodes.Clear(); this.textBox1.Text = ""; UnitTreeNode node = this.tree.TypeTree.SelectedNode as UnitTreeNode; if (node == null) { return; } ReportRun result = this.Tree.TestDomains.GetResult(node); if (result != null && result.Result == ReportRunResult.Failure) { AddException(result.Exception); } }
void TestEngineSkip(ReportRun run) { this.skipCount++; TestResult summary = new TestResult(); summary.State = TDF.TestState.Ignored; summary.TotalTests = this.testCount; summary.Name = run.Name; summary.TimeSpan = new TimeSpan(0, 0, 0, 0, 0); if (run.Exception != null) { ReportException ex = run.Exception; summary.Message = run.Exception.Message; summary.StackTrace = ex.ToString(); } testListener.WriteLine(String.Format("[skipped] {0}", run.Name), Category.Info); this.testListener.TestFinished(summary); }
void TestEngineFailure(ReportRun run) { this.failureCount++; TestResult summary = new TestResult(); summary.State = TDF.TestState.Failed; summary.TotalTests = this.testCount; summary.Name = run.Name; summary.TimeSpan = new TimeSpan(0, 0, 0, 0, (int)(run.Duration * 1000)); if (run.Exception != null) { ReportException ex = run.Exception; summary.Message = run.Exception.Message; summary.StackTrace = ex.ToString(); } testListener.WriteLine(String.Format("[failure] {0}", run.Name), Category.Info); this.testListener.TestFinished(summary); }
public void Skip(RunPipe pipe, ReportRun result) { this.OnChanged(pipe.Identifier, TestState.Skip); }
public void Ignore(RunPipe pipe, ReportRun result) { Writer.WriteLine("[ignored] {0}", pipe.Name); }
// MLS 12/21/05 - changing some of the messages below to give details more like the AutoRunner, // although it still doesn't show all the details that the AutoRunner does. // TOOD: Refactor so that this is exactly like the AutoRunner, and remove duplicate code. public void Success(RunPipe pipe, ReportRun result) { Writer.WriteLine("[success] {0}", pipe.Name); }
public void Skip(RunPipe pipe, ReportRun result) { }
public void Failure(RunPipe pipe, ReportRun result) { Writer.WriteLine("[failure] {0}: {1}", pipe.Name, result.Exception.Message); }
void IRunPipeListener.Skip(RunPipe pipe, ReportRun result) { HandleTestFinish(pipe, result); }
void IReportsCommand.CreateReportRun(ReportRun reportRun) { reportRun.Prepare(); reportRun.Validate(); _repository.CreateReportRun(reportRun); }
public void ClearResult() { this.result = null; this.abortPending = false; }
void IEmployerReportsCommand.CreateReportRun(ReportRun reportRun) { _reportsCommand.CreateReportRun(reportRun); }
public void Failure(RunPipe pipe, ReportRun result) { this.OnChanged(pipe.Identifier, TestState.Failure); }
public void Run(Object fixture, bool IsExplicit) { if (fixture == null) { throw new ArgumentNullException("fixture"); } // create arguments... ArrayList args = new ArrayList(); this.abortPending = false; this.monitor.Start(); this.Start(); Exception testException = null; foreach (RunInvokerVertex v in pipe.Invokers) { if (!v.HasInvoker) { continue; } if (v.Invoker is ExplicitRunInvoker && !IsExplicit) { testException = new IgnoreRunException("Explicit selection required."); } // if exception has already been thrown, execute non test only if (testException != null) { if (!v.Invoker.Generator.IsTest) { // execute tear down code and drop exceptions try { v.Invoker.Execute(fixture, args); } catch (Exception) { } } } else { try { if (this.IsAbortPending) { continue; } if (v.Invoker.Generator.IsTest) { v.Invoker.Execute(fixture, args); } else { // can't re-use args for TearDown, or we get a parameter mismatch! v.Invoker.Execute(fixture, new ArrayList()); } } catch (Exception ex) { testException = ex; } } } this.monitor.Stop(); // success if (testException == null) { this.result = ReportRun.Success(this.pipe, this.monitor); this.Success(); } else { // get rid of TargetInvocationException if (testException.GetType() == typeof(TargetInvocationException)) { testException = testException.InnerException; } // check if ignoreexception if (testException is IgnoreRunException) { this.result = ReportRun.Ignore(this.pipe, this.monitor); this.Ignore(); } // failure else { this.result = ReportRun.Failure(this.pipe, this.monitor, testException); this.Failure(); } } }
public void Ignore(RunPipe pipe, ReportRun result) { this.OnChanged(pipe.Identifier, TestState.Ignored); }