/// <summary> /// Returns a summary of this test /// </summary> /// <returns></returns> public override string GetTestSummary() { // Handle case where there aren't any session artifacts, for example with device starvation if (SessionArtifacts == null) { return("NoSummary"); } MarkdownBuilder ReportBuilder = new MarkdownBuilder(); // add header ReportBuilder.Append(GetTestSummaryHeader()); ReportBuilder.Append("--------"); StringBuilder SB = new StringBuilder(); // Get any artifacts with failures var FailureArtifacts = GetArtifactsWithFailures(); // Any with warnings (ensures) var WarningArtifacts = SessionArtifacts.Where(A => A.LogSummary.Ensures.Count() > 0); // combine artifacts into order as Failures, Warnings, Other var AllArtifacts = FailureArtifacts.Union(WarningArtifacts); AllArtifacts = AllArtifacts.Union(SessionArtifacts); // Add a summary of each foreach (var Artifact in AllArtifacts) { string Summary = "NoSummary"; int ExitCode = GetRoleSummary(Artifact, out Summary); if (SB.Length > 0) { SB.AppendLine(); } SB.Append(Summary); } ReportBuilder.Append(SB.ToString()); return(ReportBuilder.ToString()); }
/// <summary> /// Returns a summary of this test /// </summary> /// <returns></returns> public override string GetTestSummary() { int AbnormalExits = 0; int FatalErrors = 0; int Ensures = 0; int Errors = 0; int Warnings = 0; StringBuilder SB = new StringBuilder(); // Sort our artifacts so any missing processes are first var ProblemArtifacts = GetArtifactsWithFailures(); var AllArtifacts = ProblemArtifacts.Union(SessionArtifacts); // create a quicck summary of total failures, ensures, errors, etc foreach (var Artifact in AllArtifacts) { string Summary = "NoSummary"; int ExitCode = GetRoleSummary(Artifact, out Summary); if (ExitCode != 0 && Artifact.AppInstance.WasKilled == false) { AbnormalExits++; } if (SB.Length > 0) { SB.AppendLine(); } SB.Append(Summary); FatalErrors += Artifact.LogSummary.FatalError != null ? 1 : 0; Ensures += Artifact.LogSummary.Ensures.Count(); Errors += Artifact.LogSummary.Errors.Count(); Warnings += Artifact.LogSummary.Warnings.Count(); } MarkdownBuilder MB = new MarkdownBuilder(); // Create a summary MB.H2(string.Format("{0} {1}", Name, GetTestResult())); if (GetTestResult() != TestResult.Passed) { if (ProblemArtifacts.Count() > 0) { foreach (var FailedArtifact in ProblemArtifacts) { string FirstProcessCause = ""; int FirstExitCode = GetExitCodeAndReason(FailedArtifact, out FirstProcessCause); MB.H3(string.Format("{0}: {1}", FailedArtifact.SessionRole.RoleType, FirstProcessCause)); if (FailedArtifact.LogSummary.FatalError != null) { MB.H4(FailedArtifact.LogSummary.FatalError.Message); } } MB.Paragraph("See below for callstack and logs"); } } MB.Paragraph(string.Format("Context: {0}", Context.ToString())); MB.Paragraph(string.Format("FatalErrors: {0}, Ensures: {1}, Errors: {2}, Warnings: {3}", FatalErrors, Ensures, Errors, Warnings)); //MB.Paragraph(string.Format("Artifacts: {0}", CachedArtifactPath)); MB.Append("--------"); MB.Append(SB.ToString()); //SB.Clear(); //SB.AppendLine("begin: stack for UAT"); //SB.Append(MB.ToString()); //SB.Append("end: stack for UAT"); return(MB.ToString()); }
/// <summary> /// Returns a summary of this test /// </summary> /// <returns></returns> public override string GetTestSummary() { int AbnormalExits = 0; int FatalErrors = 0; int Ensures = 0; int Errors = 0; int Warnings = 0; // Handle case where there aren't any session artifacts, for example with device starvation if (SessionArtifacts == null) { return("NoSummary"); } StringBuilder SB = new StringBuilder(); // Get any artifacts with failures var FailureArtifacts = GetArtifactsWithFailures(); // Any with warnings (ensures) var WarningArtifacts = SessionArtifacts.Where(A => A.LogSummary.Ensures.Count() > 0); // combine artifacts into order as Failures, Warnings, Other var AllArtifacts = FailureArtifacts.Union(WarningArtifacts); AllArtifacts = AllArtifacts.Union(SessionArtifacts); // create a quicck summary of total failures, ensures, errors, etc foreach (var Artifact in AllArtifacts) { string Summary = "NoSummary"; int ExitCode = GetRoleSummary(Artifact, out Summary); if (ExitCode != 0 && Artifact.AppInstance.WasKilled == false) { AbnormalExits++; } if (SB.Length > 0) { SB.AppendLine(); } SB.Append(Summary); FatalErrors += Artifact.LogSummary.FatalError != null ? 1 : 0; Ensures += Artifact.LogSummary.Ensures.Count(); Errors += Artifact.LogSummary.Errors.Count(); Warnings += Artifact.LogSummary.Warnings.Count(); } MarkdownBuilder MB = new MarkdownBuilder(); string WarningStatement = HasWarnings ? " With Warnings" : ""; // Create a summary MB.H2(string.Format("{0} {1}{2}", Name, GetTestResult(), WarningStatement)); if (GetTestResult() != TestResult.Passed) { if (FailureArtifacts.Count() > 0) { foreach (var FailedArtifact in FailureArtifacts) { string FirstProcessCause = ""; int FirstExitCode = GetExitCodeAndReason(FailedArtifact, out FirstProcessCause); MB.H3(string.Format("{0}: {1}", FailedArtifact.SessionRole.RoleType, FirstProcessCause)); if (FailedArtifact.LogSummary.FatalError != null) { MB.H4(FailedArtifact.LogSummary.FatalError.Message); } } MB.Paragraph("See below for callstack and logs"); } } MB.Paragraph(string.Format("Context: {0}", Context.ToString())); MB.Paragraph(string.Format("FatalErrors: {0}, Ensures: {1}, Errors: {2}, Warnings: {3}", FatalErrors, Ensures, Errors, Warnings)); MB.Paragraph(string.Format("ResultHash: {0}", GetTestResultHash())); //MB.Paragraph(string.Format("Artifacts: {0}", CachedArtifactPath)); MB.Append("--------"); MB.Append(SB.ToString()); //SB.Clear(); //SB.AppendLine("begin: stack for UAT"); //SB.Append(MB.ToString()); //SB.Append("end: stack for UAT"); return(MB.ToString()); }