public void CreateSheet(int yellowBand, int greenBand, NCrunchCoverageDataCollection coverage) { SetPercentageBands(yellowBand, greenBand); coverage.ThrowIfNull("coverageData"); IRow row = sheet.CreateRow(0); row.CreateHeadings(ColProjectFileName, "ProjectFileName", "Coverage", "CompiledLines", "CoveredLines", "UncoveredLines", "ProjectPathName"); sheet.SetColumnWidths(ColProjectFileName, 10000, 4000, 4000, 4000, 4000, 20000); int i = 1; foreach (var r in coverage.SummariseByProject) { row = sheet.CreateRow(i); row.SetCell(ColProjectFileName, r.ProjectFileName); row.SetCell(ColCoverage, r.Coverage).FormatPercentage().ApplyStyle(); row.SetCell(ColCompiledLines, r.CompiledLines); row.SetCell(ColCoveredLines, r.CoveredLines); row.SetCell(ColUncoveredLines, r.UncoveredLines); row.SetCell(ColProjectPathName, r.ProjectPathName); i++; } sheet.FreezeTopRow(); ApplyPercentageFormatting(ColCoverage, 1, i); }
int CreateSummary(string largeHeaderName, int rowNum, TestResultSummary summary, IEnumerable <string> outcomes) { int colNum = 0; int topOfSums = rowNum + 3; rowNum = CreateSummaryHeading(largeHeaderName, rowNum); IRow row = sheet.CreateRow(rowNum++); row.CreateHeadings(ColAssembly, "Assembly", "Class", "Time (secs)", "Time (hh:mm:ss)", "Pass Rate", "Total"); colNum = ColPassed; foreach (var oc in outcomes) { row.SetCell(colNum++, oc).HeaderStyle().ApplyStyle(); } foreach (var s in summary.SummaryLines.OrderBy(line => line.AssemblyFileName).ThenBy(line => line.ClassName)) { row = sheet.CreateRow(rowNum++); row.SetCell(ColAssembly, s.AssemblyFileName); row.SetCell(ColClass, s.ClassName); row.SetCell(ColTime, s.TotalDurationInSeconds).Format("0.00").ApplyStyle(); row.SetCell(ColTimeHuman, s.TotalDurationInSecondsHuman).Alignment(HorizontalAlignment.Right).ApplyStyle(); row.SetCell(ColPercent, s.PercentPassed).FormatPercentage().ApplyStyle(); row.SetCell(ColTotal, s.TotalTests); colNum = ColPassed; foreach (var oc in s.Outcomes) { var cell = row.SetCell(colNum++, oc.NumTests); if (oc.Outcome == KnownOutcomes.Failed && oc.NumTests > 0) { cell.SolidFillColor(HSSFColor.Red.Index).ApplyStyle(); } else if (oc.Outcome != KnownOutcomes.Passed && oc.NumTests > 0) { cell.SolidFillColor(HSSFColor.Yellow.Index).ApplyStyle(); } } } row = sheet.CreateRow(rowNum++); row.SetCell(ColTime, summary.TotalDurationInSeconds).SummaryStyle().Format("0.00").ApplyStyle(); row.SetCell(ColTimeHuman, summary.TotalDurationInSecondsHuman).SummaryStyle().Alignment(HorizontalAlignment.Right).ApplyStyle(); row.SetCell(ColPercent, summary.PercentPassed).SummaryStyle().FormatPercentage().ApplyStyle(); row.SetCell(ColTotal, summary.TotalTests).SummaryStyle().ApplyStyle(); int cn = ColPassed; foreach (var oc in outcomes) { row.SetCell(cn++, summary.TotalByOutcome(oc)).SummaryStyle().ApplyStyle(); } ApplyPercentageFormatting(ColPercent, topOfSums, rowNum - 1); ApplyFailedFormattingRules(topOfSums, rowNum - 1); return(rowNum); }
public void CreateSheet(int yellowBand, int greenBand, ParsedData parsedData) { SetPercentageBands(yellowBand, greenBand); parsedData.ThrowIfNull("parsedData"); IRow row = sheet.CreateRow(0); row.CreateHeadings(ColAssemblyFileName, "AssemblyFileName", "ClassName", "TestName", "Outcome", "DurationInSeconds", "DurationInSecondsHuman", "ErrorMessage", "StackTrace", "StartTime", "EndTime", "ResultsPathName", "ResultsFileName", "AssemblyPathName", "FullClassName", "ComputerName", "TestResultFileType"); sheet.SetColumnWidths(ColAssemblyFileName, 10000, 10000, 10000, 3000, 3000, 3000, 3000, 5500, 5500); int i = 1; foreach (var r in parsedData.ResultLines.SortedByFailedOtherPassed) { row = sheet.CreateRow(i); row.SetCell(ColAssemblyFileName, r.AssemblyFileName); row.SetCell(ColClassName, r.ClassName); row.SetCell(ColTestName, r.TestName); row.SetCell(ColOutcome, r.Outcome); row.SetCell(ColDurationInSeconds, r.DurationInSeconds).Format("0.00").ApplyStyle(); row.SetCell(ColDurationInSecondsHuman, r.DurationHuman).Alignment(HorizontalAlignment.Right).ApplyStyle(); row.SetCell(ColErrorMessage, r.ErrorMessage); row.SetCell(ColStackTrace, r.StackTrace); if (r.StartTime != null) { row.SetCell(ColStartTime, r.StartTime.Value).FormatLongDate().ApplyStyle(); } if (r.EndTime != null) { row.SetCell(ColEndTime, r.EndTime.Value).FormatLongDate().ApplyStyle(); } row.SetCell(ColResultsPathName, r.ResultsPathName); row.SetCell(ColResultsFileName, r.ResultsFileName); row.SetCell(ColAssemblyPathName, r.AssemblyPathName); row.SetCell(ColFullClassName, r.FullClassName); row.SetCell(ColComputerName, r.ComputerName); row.SetCell(ColTestResultFileType, r.TestResultFileType.ToString()); i++; } sheet.FreezeTopRow(); ApplyOutcomeFormattingRules(i); }
void CreateSlowestTests(int rowNum, IEnumerable <SlowestTest> slowestTests) { rowNum = CreateSummaryHeading("20 Slowest Tests", rowNum); IRow row = sheet.CreateRow(rowNum++); row.CreateHeadings(ColAssembly, "Assembly", "Class", "Time (secs)", "Time (hh:mm:ss)", "Test Name"); var range = new CellRangeAddress(row.RowNum, row.RowNum, ColPercent, maxColumnUsed); sheet.AddMergedRegion(range); foreach (var t in slowestTests) { row = sheet.CreateRow(rowNum++); row.SetCell(ColAssembly, t.AssemblyFileName); row.SetCell(ColClass, t.ClassName); row.SetCell(ColTime, t.DurationInSeconds).Format("0.00").ApplyStyle(); row.SetCell(ColTimeHuman, t.DurationHuman).Alignment(HorizontalAlignment.Right).ApplyStyle(); row.SetCell(ColPercent, t.TestName); range = new CellRangeAddress(row.RowNum, row.RowNum, ColPercent, maxColumnUsed); sheet.AddMergedRegion(range); } }