GHPReporter / Ghpr.Console

Console application to convert NUnit and MSTest test result files into Ghpr HTML Report
http://ghpreporter.github.io/
MIT License
5 stars 5 forks source link

Retention - clean up job - Doesn't appear to work #54

Closed msscribner closed 4 years ago

msscribner commented 4 years ago

I'm setting the Retention amount and till, but old runs remain in the newly generated report.

Steps to reproduce the behavior: I’ve adjusted the ‘amount’ from 1000 down to 3. When I generate a new report, the ‘Total Runs’ continues to tick up. I’ve adjusted the ‘till’ from "2017-01-25 10:00:00" to "2019-11-27 13:34:00" (Current Date/Time) and when I generate a new report, ALL previously generated reports remain. It does not appear that any reports are removed.

  1. Set Retention:Amount = 3
  2. Set Retention:Till = "2019-11-27 13:34:00"
  3. Generate report with 8 runs

Expected behavior Expected reports prior to “2019-11-27 13:34:00” to be removed. I expected reports with highlighted dates to be removed. image

Also expected 'Total Runs' to not exceed 3, but every time a run is executed, the Total Runs increments by one: image

I was also expect file generated prior to “2019-11-27 13:34:00” to be removed from the 'runs' folder...but they remain. image

Ghpr.Core.settings.json: { "default": { "outputPath": "C:\ProgramData\Selenium\GHPRReport\Reports\OctopusMaintenance\ALL", "dataServiceFile": "Ghpr.LocalFileSystem.dll", "loggerFile": "", "sprint": "", "reportName": "OctopusMaintenance", "projectName": "P1-P2", "runName": "11/27/19_13:38:33", "runGuid": "", "realTimeGeneration": "True", "runsToDisplay": "15", "testsToDisplay": "1000", "retention": { "amount": 3, "till": "2019-11-27 13:34:00" } }, "projects": null }

I'm concerned that if 'clean up job' doesn't run, I'll eventually consume all the disk space.

NUGET Package: I’m using NUGET packages: Ghpr.Console version="0.9.9.1" Ghpr.Core version="0.9.9.9" Ghpr.LocalFileSystem version="0.9.9.9" Ghpr.MSTestV2 version="0.9.9.1" Ghpr.NUnit version="0.9.9.9" MSTest.TestAdapter version="1.4.0" MSTest.TestFramework version="1.4.0" NUnit version="3.12.0" NUnit.Engine version="3.10.0"

Browser: Chrome

msscribner commented 4 years ago

A little more information:

I'm calling the API: Ghpr.Cli.ReportHelper.GenerateReport (... ). It doesn't appear to me, that this functionality calls the CleanUpJob() method.

I was able to get my process to work by calling: ReportHelper.GenerateReport(files.ToArray()); var reporter = ReporterFactory.Build(new TestDataProvider()); reporter.CleanUpJob(); reporter.TearDown();

Question:

  1. Should ReportHelper.GenerateReport() call the CleanUpJob() method? Is this a bug?
  2. Is it OK to call the CleanUpJob() method directory (like I stubbed out)?
  3. Should my process interact directly with the Ghpr.Core.Common ... for example: var reporter = ReporterFactory.Build(new TestDataProvider()); var tests = new List<System.Collections.Generic.KeyValuePair<TestRunDto, TestOutputDto>>();

        foreach (var path in paths)
        {
            tests.AddRange(GhprNUnitRunHelper.GetTestRunsListFromFile(path, reporter.Logger)
                .Select(g => new KeyValuePair<TestRunDto, TestOutputDto>(g.GhprTestRun, g.GhprTestOutput)).ToList());
        }
    
        reporter.GenerateFullReport(tests);
        reporter.CleanUpJob();
        reporter.TearDown();
elv1s42 commented 4 years ago

Hi @msscribner! Sorry for the late response.

Regarding your questions.

  1. Yes, this is a bug, I'll fix and include in the next release.
  2. Yes, this is how it's used now by Ghpr.NUnit but missing in the Ghpr.Console.
  3. Yes, it's possible. Your code is very close to what we have in the Ghpr.Console now

Regards, Evgeniy

elv1s42 commented 4 years ago

The bug was in the Ghpr.Console repository, I'll release it today as v0.9.10

elv1s42 commented 4 years ago

This now has been released. Please feel free to reopen the issue or raise a new one in case something is not working.