private void WriteSummary(TestRunResult run, StringBuilder result) { result.AppendFormat(@"<table id='tMainSummary' border='0' width='900px'> <tr> <th>Percent</th> <th>Status</th> <th>TotalTests</th> <th>Passed</th> <th>Failed</th> <th>Inconclusive</th> <th>TimeTaken</th> </tr> <tr> <td>{0}%</td> <td width='350px' style='vertical-align:middle;font-size:200%'>{1}</td> <td>{2}</td> <td>{3}</td> <td>{4}</td> <td>{5}</td> <td>{6}</td> </tr> </table> <br />" , run.TotalPercent, CreateHtmlBars(run), run.TotalMethods, run.Passed, run.Failed, run.Inconclusive, run.TimeTaken); }
private void WriteSummaryDetails(TestRunResult run, StringBuilder result) { result.Append(@"<table id='tSummaryDetail' border='0' width='900px' > <tr> <th colspan='7'>ALL TestClasses Summary (<a href='#' onclick='showAllTestClassesSummary()'> Show All</a> )</th> </tr> <tr> <th>Class Name</th> <th>Percent</th> <th>Status</th> <th>TestsPassed</th> <th>TestsFailed</th> <th>TestsIgnored</th> <th>Duration</th> </tr>" ); foreach (var testClass in run.TestClassList) { result.Append("<tr>"); result.AppendFormat("<td><a href='#{0}'>{1}</a></td>", testClass.Name, testClass.Name); result.AppendFormat("<td>{0}%</td>", testClass.Percent); result.AppendFormat("<td style=\"padding:5px;\">{0}</td>", CreateHtmlBars(testClass)); result.AppendFormat("<td>{0}</td>", testClass.Success); result.AppendFormat("<td>{0}</td>", testClass.Failed); result.AppendFormat("<td>{0}</td>", testClass.Ignored); result.AppendFormat("<td>{0}</td>", testClass.Duration); result.AppendFormat("</tr>\r\n"); } result.Append("</table>"); }
private void WriteFooter(TestRunResult run, StringBuilder result) { result.Append("<hr style=\"border-style:dotted;color:#dcdcdc\"/>" + "<i style=\"width:100%;font:10pt Verdana;text-align:center;background-color:#dcdcdc\">" + "The VSTS Test Results HTML Viewer. (c) <a href=\"http://blogs.msdn.com/rido\">rido</a>'2011" + "</i>"); result.Append("</body></html>"); }
private void WriteSlowerMethods(TestRunResult run, StringBuilder result) { result.Append("<a name='slower' /><h5>TOP 5 Slower Methods</h5><table id=\"tSlowerMethods\" border='0' width='900px'>" + "<tr><th>TestMethod</th><th colspan='2'>Status</th><th>Duration</th></tr>"); foreach (var m in run.TopSlowerMethods) { WriteTestMethodResult(m, result); //result.AppendFormat("<tr><td>{0}.{1}</td><td>{2}</td><td>{3}</td></tr>", // GetClassNameFromFullName(m.TestClass), m.TestMethodName, m.Status, m.Duration); } result.Append("</table>"); }
private void WriteBody(TestRunResult run, StringBuilder result) { WriteSummary(run, result); WriteSummaryDetails(run, result); WriteSlowerMethods(run, result); var classes = run.TestMethodRunList.GroupBy(m => m.TestClass); foreach (var c in classes) { TestClassRun tcr = run.TestClassList.First(tc => tc.FullName == c.Key); WriteClassResult(tcr, result); } }
private void WriteEnvironmentInfo(TestRunResult run, StringBuilder result) { result.Append("<br /><a name=\"envInfo\" /><table width='900px'><tr><th colspan=\"2\">TestRun Environment Information</th></tr>"); result.AppendFormat("<tr><th align=\"right\">MachineName</th><td>{0}</td></tr>", run.Computers.First()); result.Append("<tr><th align=\"right\">TestAssemblies</th><td>"); foreach (var a in run.Assemblies) { result.Append(a.FullName + " <br />"); } result.Append("</td></tr>"); result.AppendFormat("<tr><th align=\"right\">UserName</th><td>{0}</td></tr>", run.UserName); result.AppendFormat("<tr><th align=\"right\">TRX File</th><td>{0}</td></tr>", run.Name); result.Append("</table>"); }
public HtmlConverter(TestRunResult testRunResult) { run = testRunResult; }