private static string GetFinishedMessage(RunFinishedMessage message) { var report = message.Report; var failed = report.NumberOfBuildsFailed > 0 || report.NumberOfTestsFailed > 0; var text = ""; if (failed) { text = string.Format( "Ran {0} build(s) ({1} succeeded, {2} failed) and {3} test(s) ({4} passed, {5} failed, {6} ignored)", report.NumberOfProjectsBuilt, report.NumberOfBuildsSucceeded, report.NumberOfBuildsFailed, report.NumberOfTestsRan, report.NumberOfTestsPassed, report.NumberOfTestsFailed, report.NumberOfTestsIgnored); } else { text = string.Format( "Ran {0} build(s) and {1} test(s)", report.NumberOfProjectsBuilt, report.NumberOfTestsRan); } var statusText = failed ? "FAILED: " : "Succeeded: "; return(statusText + text); }
public void Should_subscribe_to_run_finished_messages() { var message = new RunFinishedMessage(null); _bus.Publish(message); waitForAsyncCall(); _view.RunFinishedMessage.ShouldBeTheSameAs(message); }
public void Should_serialize_run_finished_message() { var runreport = new RunReport(); runreport.AddBuild("project 1", new TimeSpan(23), true); runreport.AddBuild("project 2", new TimeSpan(12), false); runreport.AddTestRun("project 2", "assembly", new TimeSpan(52), 12, 1, 2); runreport.WasAborted(); var message = new RunFinishedMessage(runreport); var output = serializeDeserialize <RunFinishedMessage>(message); output.Report.NumberOfBuildsSucceeded.ShouldEqual(1); output.Report.NumberOfBuildsFailed.ShouldEqual(1); output.Report.RunActions[0].Project.ShouldEqual("project 1"); output.Report.RunActions[0].Type.ShouldEqual(InformationType.Build); output.Report.RunActions[0].Succeeded.ShouldEqual(true); output.Report.RunActions[0].TimeSpent.ShouldEqual(new TimeSpan(23)); output.Report.RunActions[1].Project.ShouldEqual("project 2"); output.Report.RunActions[1].Type.ShouldEqual(InformationType.Build); output.Report.RunActions[1].Succeeded.ShouldEqual(false); output.Report.RunActions[1].TimeSpent.ShouldEqual(new TimeSpan(12)); output.Report.Aborted.ShouldBeTrue(); output.Report.NumberOfTestsPassed.ShouldEqual(12); output.Report.NumberOfTestsFailed.ShouldEqual(2); output.Report.NumberOfTestsIgnored.ShouldEqual(1); output.Report.RunActions[2].Project.ShouldEqual("project 2"); output.Report.RunActions[2].Assembly.ShouldEqual("assembly"); output.Report.RunActions[2].Type.ShouldEqual(InformationType.TestRun); output.Report.RunActions[2].Succeeded.ShouldEqual(false); output.Report.RunActions[2].TimeSpent.ShouldEqual(new TimeSpan(52)); }
public void Should_subscribe_to_run_finished_messages() { var message = new RunFinishedMessage(null); _bus.Publish(message); waitForAsyncCall(() => { return(_view.RunFinishedMessage != null); }); _view.RunFinishedMessage.ShouldBeTheSameAs(message); }
public void Should_be_able_to_consume_run_finished_messages() { var consumer = new RunMessageConsumer(_bus); var message = new RunFinishedMessage(null); _bus.Publish(message); waitForAsyncCall(); consumer.RunFinishedMessageEventWasCalled.ShouldBeTrue(); }
public void Consume(RunFinishedMessage message) { if (!isConnected()) { return; } _client.Send( string.Format("autotest.net runfinished {0} {1}", message.Report.NumberOfBuildsFailed, message.Report.NumberOfTestsFailed)); }
public void RecievingRunFinishedMessage(RunFinishedMessage message) { Debug.WriteDebug("handling run finished"); if (RunFinished != null) { RunFinished(this, new EventArgs()); } trySend(message); if (_configuration.NotifyOnRunCompleted) { runNotification(getRunFinishedMessage(message.Report), message.Report); } }
public void RecievingRunFinishedMessage(RunFinishedMessage message) { var report = message.Report; var text = string.Format( "Ran {0} build(s) ({1} succeeded, {2} failed) and {3} test(s) ({4} passed, {5} failed, {6} ignored)", report.NumberOfProjectsBuilt, report.NumberOfBuildsSucceeded, report.NumberOfBuildsFailed, report.NumberOfTestsRan, report.NumberOfTestsPassed, report.NumberOfTestsFailed, report.NumberOfTestsIgnored); var runType = report.NumberOfBuildsFailed > 0 || report.NumberOfTestsFailed > 0 ? RunMessageType.Failed : RunMessageType.Succeeded; _onMessage.Invoke(new RunMessages(runType, text)); }
public void RecievingRunFinishedMessage(RunFinishedMessage message) { var report = message.Report; var text = string.Format( "Ran {0} build(s) ({1} succeeded, {2} failed) and {3} test(s) ({4} passed, {5} failed, {6} ignored)", report.NumberOfProjectsBuilt, report.NumberOfBuildsSucceeded, report.NumberOfBuildsFailed, report.NumberOfTestsRan, report.NumberOfTestsPassed, report.NumberOfTestsFailed, report.NumberOfTestsIgnored); var runType = report.NumberOfBuildsFailed > 0 || report.NumberOfTestsFailed > 0 ? RunMessageType.Failed : RunMessageType.Succeeded; _onMessage.Invoke(new RunMessages(runType, text)); }
private RunFinishedInfo getRunFinishedInfo(RunFinishedMessage message) { var report = message.Report; var text = string.Format( "Ran {0} build(s) ({1} succeeded, {2} failed) and {3} test(s) ({4} passed, {5} failed, {6} ignored)", report.NumberOfProjectsBuilt, report.NumberOfBuildsSucceeded, report.NumberOfBuildsFailed, report.NumberOfTestsRan, report.NumberOfTestsPassed, report.NumberOfTestsFailed, report.NumberOfTestsIgnored); var succeeded = !(report.NumberOfBuildsFailed > 0 || report.NumberOfTestsFailed > 0); return(new RunFinishedInfo(text, succeeded, report)); }
private RunStatus setRunStatus(RunFinishedMessage message) { if (message.Report.Aborted) { return(RunStatus.Aborted); } if (message.Report.NumberOfBuildsFailed == 0 && message.Report.NumberOfTestsFailed == 0) { return(RunStatus.Green); } if (message.Report.NumberOfBuildsFailed == 0) { return(RunStatus.Red); } return(RunStatus.Red); }
public void RecievingRunFinishedMessage(RunFinishedMessage message) { var report = message.Report; var msg = string.Format( "Ran {0} build(s) ({1} succeeded, {2} failed) and {3} test(s) ({4} passed, {5} failed, {6} ignored)", report.NumberOfProjectsBuilt, report.NumberOfBuildsSucceeded, report.NumberOfBuildsFailed, report.NumberOfTestsRan, report.NumberOfTestsPassed, report.NumberOfTestsFailed, report.NumberOfTestsIgnored); _logger.Info(msg); if (_configuration.NotifyOnRunCompleted) { runNotification(msg, report); } }
private void sendAnalytics(RunFinishedMessage message) { if (message.Report.Aborted) { Analytics.SendEvent("RunAborted"); } else if (message.Report.NumberOfBuildsFailed == 0 && message.Report.NumberOfTestsFailed == 0) { Analytics.SendEvent("RunPassed"); } else if (message.Report.NumberOfBuildsFailed > 0) { Analytics.SendEvent("BuildFailed"); } else { Analytics.SendEvent("TestsFailed"); } }
private void runFinished(RunFinishedMessage msg) { _syncContext.Post(x => { setProgress(false, "", false, null); if (((RunFinishedMessage)x).Report.Aborted) { if (ShowRunInformation) { printMessage(new RunMessages(RunMessageType.Normal, "last build/test run was aborted")); } } else { var i = getRunFinishedInfo((RunFinishedMessage)x); var runType = i.Succeeded ? RunMessageType.Succeeded : RunMessageType.Failed; printMessage(new RunMessages(runType, i.Text)); generateSummary(i.Report); } _isRunning = false; }, msg); }
public void RecievingRunFinishedMessage(RunFinishedMessage message) { _syncContext.Post( x => { var report = (RunReport)x; var msg = string.Format( "Ran {0} build(s) ({1} succeeded, {2} failed) and {3} test(s) ({4} passed, {5} failed, {6} ignored)", report.NumberOfProjectsBuilt, report.NumberOfBuildsSucceeded, report.NumberOfBuildsFailed, report.NumberOfTestsRan, report.NumberOfTestsPassed, report.NumberOfTestsFailed, report.NumberOfTestsIgnored); _running = false; labelRunState.Text = msg; if (report.NumberOfBuildsFailed > 0 || report.NumberOfTestsFailed > 0) { labelRunState.ForeColor = Color.Red; } if (report.NumberOfBuildsFailed == 0 && report.NumberOfTestsFailed == 0 && report.NumberOfTestsIgnored > 0) { labelRunState.ForeColor = Color.YellowGreen; } if (report.NumberOfBuildsFailed == 0 && report.NumberOfTestsFailed == 0 && report.NumberOfTestsIgnored == 0) { labelRunState.ForeColor = Color.Green; } generateSummary(report); if (_configuration.NotifyOnRunCompleted) { runNotification(msg, report); } }, message.Report); }
private void runFinished(RunFinishedMessage msg) { _syncContext.Post(x => { if (((RunFinishedMessage)x).Report.Aborted) { if (ShowRunInformation) { setProgress(ImageStates.None, "", false, null); printMessage(new RunMessages(RunMessageType.Normal, "last build/test run was aborted")); } } else { var i = getRunFinishedInfo((RunFinishedMessage)x); var runType = i.Succeeded ? RunMessageType.Succeeded : RunMessageType.Failed; setProgress(runType == RunMessageType.Succeeded ? ImageStates.Green : ImageStates.Red, "", false, null); printMessage(new RunMessages(runType, i.Text)); generateSummary(i.Report); } _isRunning = false; organizeListItemBehaviors(listViewFeedback.SelectedItems); }, msg); }
private void runFinished(RunFinishedMessage x) { if (((RunFinishedMessage)x).Report.Aborted) { if (ShowRunInformation) { var i = getRunFinishedInfo((RunFinishedMessage)x); var runType = i.Succeeded ? RunMessageType.Succeeded : RunMessageType.Failed; setProgress(runType == RunMessageType.Succeeded ? ImageStates.Green : ImageStates.Red, "", false, null); printMessage(new RunMessages(runType, i.Text)); generateSummary(i.Report); } } else { var i = getRunFinishedInfo((RunFinishedMessage)x); var runType = i.Succeeded ? RunMessageType.Succeeded : RunMessageType.Failed; setProgress(runType == RunMessageType.Succeeded ? ImageStates.Green : ImageStates.Red, "", false, null); printMessage(new RunMessages(runType, i.Text)); generateSummary(i.Report); } _isRunning = false; organizeListItemBehaviors(); }
public void Should_be_able_to_consume_run_finished_messages() { var consumer = new RunMessageConsumer(_bus); var message = new RunFinishedMessage(null); _bus.Publish(message); waitForAsyncCall(); consumer.RunFinishedMessageEventWasCalled.ShouldBeTrue(); }
public RunFinishedMessageEventArgs(RunFinishedMessage message) { Message = message; }
public void RecievingRunFinishedMessage(RunFinishedMessage message) { var report = message.Report; var msg = string.Format( "Ran {0} build(s) ({1} succeeded, {2} failed) and {3} test(s) ({4} passed, {5} failed, {6} ignored)", report.NumberOfProjectsBuilt, report.NumberOfBuildsSucceeded, report.NumberOfBuildsFailed, report.NumberOfTestsRan, report.NumberOfTestsPassed, report.NumberOfTestsFailed, report.NumberOfTestsIgnored); _logger.Info(msg); if (_configuration.NotifyOnRunCompleted) runNotification(msg, report); }
public void RecievingRunFinishedMessage(RunFinishedMessage message) { _syncContext.Post( x => { var report = (RunReport) x; var msg = string.Format( "Ran {0} build(s) ({1} succeeded, {2} failed) and {3} test(s) ({4} passed, {5} failed, {6} ignored)", report.NumberOfProjectsBuilt, report.NumberOfBuildsSucceeded, report.NumberOfBuildsFailed, report.NumberOfTestsRan, report.NumberOfTestsPassed, report.NumberOfTestsFailed, report.NumberOfTestsIgnored); _running = false; labelRunState.Text = msg; if (report.NumberOfBuildsFailed > 0 || report.NumberOfTestsFailed > 0) labelRunState.ForeColor = Color.Red; if (report.NumberOfBuildsFailed == 0 && report.NumberOfTestsFailed == 0 && report.NumberOfTestsIgnored > 0) labelRunState.ForeColor = Color.YellowGreen; if (report.NumberOfBuildsFailed == 0 && report.NumberOfTestsFailed == 0 && report.NumberOfTestsIgnored == 0) labelRunState.ForeColor = Color.Green; generateSummary(report); if (_configuration.NotifyOnRunCompleted) runNotification(msg, report); }, message.Report); }
public void RecievingRunFinishedMessage(RunFinishedMessage message) { _runFinishedMessage = message; }
public RunFinishedMessageEventArgs(RunFinishedMessage message) { Message = message; }
public void RecievingRunFinishedMessage(RunFinishedMessage message) { _runFinishedMessage = message; }