private void UpdateLevelElementStatuses(ReportElement element) { if (null == levelElementBuffer) { // No level has been started return; } if (null == element || null == element.type) { return; } if (element.status.Equals(DifidoTestStatus.success.ToString())) { // Nothing to do } DifidoTestStatus elementStatus = (DifidoTestStatus)Enum.Parse(typeof(DifidoTestStatus), element.status); foreach (ReportElement currElement in levelElementBuffer) { DifidoTestStatus currElementStatus = (DifidoTestStatus)Enum.Parse(typeof(DifidoTestStatus), currElement.status); if (elementStatus > currElementStatus) { currElement.status = elementStatus.ToString(); } } }
public void Report(string title, string message, DifidoTestStatus status, ReportElementType type) { foreach (IReporter reporter in reporters) { lock (syncRoot) { reporter.Report(title, message, status, type); } } }
public void Report(string title, string message, DifidoTestStatus status, ReportElementType type) { ReportElement element = new ReportElement(); if (null == testDetails) { Console.WriteLine("HTML reporter was not initiliazed propertly. No reports would be created."); return; } element.title = title; element.message = message; element.time = DateTime.Now.ToString("HH:mm:ss"); element.status = status.ToString(); element.type = type.ToString(); testDetails.AddReportElement(element); if (type == ReportElementType.lnk || type == ReportElementType.img) { if (File.Exists(message)) { string fileName = FileWasAdded(testDetails, message); if (fileName != null) { element.message = fileName; } } } // The stopwatch is an important mechanism that helps when test is creating a large number of message in short time intervals. if (!stopwatch.IsRunning) { stopwatch.Start(); } else { if (stopwatch.ElapsedMilliseconds <= 100) { return; } } stopwatch.Restart(); TestDetailsWereAdded(testDetails); }
public void Report(string title, string message, DifidoTestStatus status, ReportElementType type) { StringBuilder sb = new StringBuilder(); switch (type) { case ReportElementType.regular: break; case ReportElementType.startLevel: sb.Append("[START LEVEL]: "); break; case ReportElementType.step: sb.Append("[STEP]: "); break; case ReportElementType.stopLevel: sb.Append("[STOP LEVEL]"); break; case ReportElementType.img: sb.Append("[IMAGE]: "); break; case ReportElementType.lnk: sb.Append("[LINK]: "); break; } switch (status) { case DifidoTestStatus.success: break; case DifidoTestStatus.warning: sb.Append("[WARNING]: "); break; case DifidoTestStatus.error: sb.Append("[ERROR]: "); break; case DifidoTestStatus.failure: sb.Append("[FAILURE]: "); break; } if (title != null && !title.Equals("")) { if (message != null && !message.Equals("")) { sb.Append(title + " - " + message); } else { sb.Append(title); } } Print(sb.ToString()); }
public void Report(string title, string message, DifidoTestStatus status) { Report(title, message, status, ReportElementType.regular); }
public void Report(string title, string message, DifidoTestStatus status, ReportElementType type) { failureReason = title; }