Esempio n. 1
0
 internal HtmlReportBuilder(DataOutputModel dataOutputModel)
 {
     _scenarios = dataOutputModel.Scenarios;
     _stories   = _scenarios.Select(scenario => scenario.GetStoryText()).Distinct().ToList();
     _testTimer = dataOutputModel.TestTimer;
     _warnings  = dataOutputModel.Warnings;
     BuildChartJavascript();
     CreateReportWithStories();
     CreateReportWithoutStories();
 }
Esempio n. 2
0
 internal HtmlReportBuilder(DataOutputModel dataOutputModel)
 {
     _scenarios = dataOutputModel.Scenarios;
     _stories   = _scenarios.Select(scenario => scenario.GetStoryText()).Distinct().ToList();
     _testTimer = dataOutputModel.TestTimer;
     _warnings  = dataOutputModel.Warnings;
     CreateFlakinessReport();
     CreateTestTimesComparisonReport();
     CreateReportWithoutStories();
     CreateReportWithStories();
 }
Esempio n. 3
0
        public static void Main(string[] args)
        {
            ResultDirectory = args.FirstOrDefault(it => it.StartsWith(WriteOutput.ResultDirectoryArgumentName))?.Replace(WriteOutput.ResultDirectoryArgumentName, "");

            Console.WriteLine($"Results Directory is: {ResultDirectory}");

            if (ResultDirectory == null)
            {
                return;
            }

            var scenarios = GetScenarios(ResultDirectory);
            var testTimer = GetTestTimer(scenarios);

            var reportPathByStory      = Path.Combine(ResultDirectory, FileNames.ReportByStory);
            var reportPathAllScenarios = Path.Combine(ResultDirectory, FileNames.ReportAllScenarios);
            var testDataJsonPath       = Path.Combine(ResultDirectory, FileNames.TestDataJson);
            var testDataXmlPath        = Path.Combine(ResultDirectory, FileNames.TestDataXml);

            DeleteExistingFiles(reportPathByStory, reportPathAllScenarios, testDataJsonPath, testDataXmlPath);

            var warnings = GetWarnings();

            scenarios.AddRange(warnings.StoppedEarlyTests);

            var dataToOutput = new DataOutputModel
            {
                Scenarios = scenarios,
                TestTimer = testTimer,
                Warnings  = warnings
            };

            var settings = new JsonSerializerSettings
            {
                PreserveReferencesHandling = PreserveReferencesHandling.Objects
            };

            var jsonData = JsonConvert.SerializeObject(dataToOutput, Formatting.Indented, settings);

            File.WriteAllText(Path.Combine(ResultDirectory, FileNames.TestDataJson), jsonData);
            File.WriteAllText(Path.Combine(ResultDirectory, FileNames.TestDataXml), JsonConvert.DeserializeXmlNode(jsonData, "TestData").ToXmlString());

            HtmlReportBuilder.CreateReport(dataToOutput);

            try
            {
                CopyFolder.Copy(Path.Combine(FileLocations.ProjectDirectory, "css"), Path.Combine(ResultDirectory, "css"));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Esempio n. 4
0
 internal static HtmlReportBuilder CreateReport(DataOutputModel dataOutputModel)
 {
     return(new HtmlReportBuilder(dataOutputModel));
 }
Esempio n. 5
0
        public static void Main(string[] args)
        {
            Args = string.Join(" ", args);

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            ResultDirectory = args.FirstOrDefault(it => it.StartsWith(Arguments.ResultDirectoryArgumentName))?.Replace(Arguments.ResultDirectoryArgumentName, "");

            SetSettingsFromArgs(args);

            if (string.IsNullOrWhiteSpace(ResultDirectory))
            {
                return;
            }

            var scenarios = GetScenarios(ResultDirectory);
            var testTimer = GetTestTimer(scenarios);

            var reportPathByStory      = Path.Combine(ResultDirectory, FileNames.ReportByStory);
            var reportPathAllScenarios = Path.Combine(ResultDirectory, FileNames.ReportAllScenarios);
            var testDataJsonPath       = Path.Combine(ResultDirectory, FileNames.TestDataJson);
            var testDataXmlPath        = Path.Combine(ResultDirectory, FileNames.TestDataXml);

            DeleteExistingFiles(reportPathByStory, reportPathAllScenarios, testDataJsonPath, testDataXmlPath);

            var warnings = GetWarnings();

            scenarios.AddRange(warnings.StoppedEarlyTests);

            var dataToOutput = new DataOutputModel
            {
                Scenarios = scenarios,
                TestTimer = testTimer,
                Warnings  = warnings
            };

            var settings = new JsonSerializerSettings
            {
                PreserveReferencesHandling = PreserveReferencesHandling.Objects
            };

            var jsonData = JsonConvert.SerializeObject(dataToOutput, Formatting.Indented, settings);


            WriteJsonOutput(jsonData);

            WriteXmlOutput(jsonData);

            PruneData();

            HtmlReportBuilder.CreateReport(dataToOutput);

            try
            {
                CopyFolder.Copy(Path.Combine(FileLocations.ProjectDirectory, "css"), Path.Combine(ResultDirectory, "css"));
            }
            catch (Exception)
            {
                // ignored
            }
        }