Open tonyhallett opened 3 years ago
Background for anyone taking on this feature.
Code required to understand own report generation
Here are built in reporters https://github.com/coverlet-coverage/coverlet/blob/fe6fee996889ac3a5e98f786ad94262260db79a4/src/coverlet.core/Reporters/ReporterFactory.cs
The cobertura reporter https://github.com/coverlet-coverage/coverlet/blob/fe6fee996889ac3a5e98f786ad94262260db79a4/src/coverlet.core/Reporters/CoberturaReporter.cs
public static CoverageReport ProcessCoberturaXmlFile(string xmlFilePath, out List<CoverageLine> coverageLines)
{
coverageLines = new List<CoverageLine>();
var report = LoadReportFile(xmlFilePath);
// the report is deserialized cobertura - create report from it !
foreach (var package in report.Packages.Package)
{
foreach (var classs in package.Classes.Class)
{
foreach (var line in classs.Lines.Line)
{
coverageLines.Add(new CoverageLine
{
Package = package,
Class = classs,
Line = line
});
}
}
}
return report;
}
The unified xml is deserialized in to the CoverageReport class.
It should be relatively simple to create a wpf table that replicates the html report
@FortuneN
Further to our video call discussion where it was desired for the microserver to return the report in a generic format. I was thinking using json over xml as would be better for html report generation.
The change could be as simple as
//unifiedJson - report type and path to change, may even be beneficial providing a custom IReportBuilder. Can remove
//autogenerated classes with the report generator class filter.
ReportGeneratorUtil.RunReportGenerator(coverOutputFiles, darkMode, out var unifiedJson, out var unifiedXmlFile, true);
//new method
//this will just set a var on the page to be processed by javascript again calling back through window.external
GenerateHtmlFile(unifiedJson,darkMode,out var coverageHTML )
A) Do you want to continue using an html file in visual studio ? If so How would you like the js ? Vanilla, knockout or react ? If the latter do you want scripts embedded in the page ? How would you like this tested ? Puppeteer or something specific to framework if used ? Do you want to leave it up to me ? I will replicate current functionality with the addition of branch coverage. If desired I can add the grouping and filtering that report generator provides. Later can incorporate visual studio options for the report display.
I am good to do this tomorrow.
If dotnet-reportgenerator-globaltool changes its internal data structure then the report window will no longer work