Пример #1
0
        private void ButtonGenerateHtmlFile_Click(object sender, EventArgs e)
        {
            if (AvailableSummary)
            {
                // Modify HTML template
                CreateReportHTML();

                // Modify Dataset in chart-bar.js
                EditBarChartDatasets();

                // Modify Dataset in chart-pie.js
                EditPieChartDatasets();

                if (CurrentPanel != null)
                {
                    CurrentPanel.Hide();
                }

                ButtonPanelHTMLOpenInBrowser.Visible = true;
                ButtonPanelHTMLOpenInBrowser.BringToFront();
                PanelReportCreated.Show();
                CurrentPanel = PanelReportCreated;
                CurrentPanel.Refresh();

                PictureBoxPanelHTML.Image = Image.FromFile("..\\..\\..\\static\\report-created.png");
                PictureBoxPanelHTML.Refresh();
                CurrentPanel.Refresh();

                string path = Path.GetFullPath(Directory.GetCurrentDirectory() + "\\..\\..\\..\\template\\report.html");
                NotifyLoadFile.ShowBalloonTip(100, "HTML Report Available", "Path: " + path, ToolTipIcon.Info);
                TestPlan.ClearResults();
            }
        }
Пример #2
0
        private void ButtonSummary_Click(object sender, EventArgs e)
        {
            AvailableSummary = true;

            if (CurrentPanel != null)
            {
                CurrentPanel.Hide();
            }

            PanelSummary.Show();
            CurrentPanel = PanelSummary;
            CurrentPanel.Refresh();

            if (AvailableLightMode == "LIGHT MODE")
            {
                PictureBoxSummary.Image = Image.FromFile("..\\..\\..\\static\\availableSummary.png");
                PictureBoxSummary.Refresh();
                ButtonDownloadXLS.Image          = Image.FromFile("..\\..\\..\\static\\downloadXlsDarkMode.png");
                ButtonGenerateHtmlFile.Image     = Image.FromFile("..\\..\\..\\static\\generateHtmlFileDarkMode.png");
                ButtonGenerateHtmlFile.ForeColor = Color.White;
                ButtonDownloadXLS.ForeColor      = Color.White;
            }
            else
            {
                PictureBoxSummary.Image          = Image.FromFile("..\\..\\..\\static\\availableSummary.png");
                ButtonDownloadXLS.Image          = Image.FromFile("..\\..\\..\\static\\downloadXls.png");
                ButtonGenerateHtmlFile.Image     = Image.FromFile("..\\..\\..\\static\\generateHtmlFile.png");
                ButtonGenerateHtmlFile.ForeColor = Color.Black;
                ButtonDownloadXLS.ForeColor      = Color.Black;
            }

            NotifyLoadFile.ShowBalloonTip(100, "Summary Created", "HTML and XLSX report creation enabled", ToolTipIcon.Info);
            Refresh();
        }
Пример #3
0
 // App Functionality Buttons
 private void buttonLoadFile_Click(object sender, EventArgs e)
 {
     try
     {
         Excel excelFile = new Excel("report.xlsx", this.NotifyLoadFile);
         excelFile.LoadData(this.TestPlan);
         NotifyLoadFile.ShowBalloonTip(100, "Data Retrieved", "Data loaded from: report.xlsx successfully", ToolTipIcon.Info);
     }
     catch
     {
         NotifyLoadFile.ShowBalloonTip(100, "Error", "Error trying to retrieve data from: report.xlsx", ToolTipIcon.Error);
     }
 }
Пример #4
0
        private void EditPieChartDatasets()
        {
            List <string> chartPie = new List <string>();

            try
            {
                using (StreamReader sr = new StreamReader("..\\..\\..\\template\\assets\\chart-pie.js"))
                {
                    string line;

                    while ((line = sr.ReadLine()) != null)
                    {
                        chartPie.Add(line);
                    }
                }
            }
            catch
            {
                NotifyLoadFile.ShowBalloonTip(100, "Error", "File is not available", ToolTipIcon.Error);
            }

            TestPlan.BuildResults();

            chartPie[4] = "dataFunctionalNewFeatures = [" + TestPlan.FunctionalNewFeaturesResults[1].ToString() + ", " + TestPlan.FunctionalNewFeaturesResults[0].ToString() + "];";
            chartPie[5] = "dataFunctionalEnhancements = [" + TestPlan.FunctionalEnhancementsResults[1].ToString() + ", " + TestPlan.FunctionalEnhancementsResults[0].ToString() + "];";
            chartPie[6] = "dataNonFunctionalNewFeatures = [" + TestPlan.NonFunctionalNewFeaturesResults[1].ToString() + ", " + TestPlan.NonFunctionalNewFeaturesResults[0].ToString() + "];";
            chartPie[7] = "dataNonFunctionalEnhancements = [" + TestPlan.NonFunctionalEnhancementsResults[1].ToString() + ", " + TestPlan.NonFunctionalEnhancementsResults[0].ToString() + "];";

            using (StreamWriter sw = new StreamWriter("..\\..\\..\\template\\assets\\chart-pie.js"))
            {
                foreach (string line in chartPie)
                {
                    sw.WriteLine(line);
                }
            }
        }
Пример #5
0
        public void EditBarChartDatasets()
        {
            List <string> chartBar = new List <string>();

            try
            {
                using (StreamReader sr = new StreamReader("..\\..\\..\\template\\assets\\chart-bar.js"))
                {
                    string line;

                    while ((line = sr.ReadLine()) != null)
                    {
                        chartBar.Add(line);
                    }
                }
            }
            catch
            {
                NotifyLoadFile.ShowBalloonTip(100, "Error", "File is not available", ToolTipIcon.Error);
            }

            TestPlan.BuildDatasets();

            chartBar[4] = "dataFunctionalNewFeaturesBar = [" + TestPlan.FunctionalNewFeatures + "];";
            chartBar[5] = "dataFunctionalEnhancementBar = [" + TestPlan.FunctionalEnhancements + "];";
            chartBar[6] = "dataNonFunctionalNewFeaturesBar = [" + TestPlan.NonFunctionalNewFeatures + "];";
            chartBar[7] = "dataNonFunctionalEnhancementBar = [" + TestPlan.NonFunctionalEnhancements + "];";

            using (StreamWriter sw = new StreamWriter("..\\..\\..\\template\\assets\\chart-bar.js"))
            {
                foreach (string line in chartBar)
                {
                    sw.WriteLine(line);
                }
            }
        }
Пример #6
0
        private void ButtonDownloadXLS_Click(object sender, EventArgs e)
        {
            if (AvailableSummary)
            {
                if (CurrentPanel != null)
                {
                    CurrentPanel.Hide();
                }

                OpenXlsxReport.Visible = true;
                OpenXlsxReport.BringToFront();
                PanelReportCreated.Show();
                CurrentPanel = PanelReportCreated;
                CurrentPanel.Refresh();

                PictureBoxPanelHTML.Image = Image.FromFile("..\\..\\..\\static\\report-created.png");
                PictureBoxPanelHTML.Refresh();
                CurrentPanel.Refresh();

                Excel workbook = new Excel("report.xlsx", this.NotifyLoadFile);
                workbook.PerformChanges(this.TestPlan);
                NotifyLoadFile.ShowBalloonTip(100, "XLSX Report Available", "Path: " + workbook.GetFilePath(), ToolTipIcon.Info);
            }
        }
Пример #7
0
        private void CreateReportHTML()
        {
            List <string> htmlDoc = new List <string>();

            try
            {
                using (StreamReader sr = new StreamReader("..\\..\\..\\template\\template.html"))
                {
                    string line;

                    while ((line = sr.ReadLine()) != null)
                    {
                        htmlDoc.Add(line);
                    }
                }
            }
            catch
            {
                NotifyLoadFile.ShowBalloonTip(100, "Error", "File is not available", ToolTipIcon.Error);
            }

            if (TestPlan.GetTestCases().Count > 0)
            {
                List <List <string> > TestCasesRows = new List <List <string> >();

                foreach (TestCase tc in TestPlan.GetTestCases())
                {
                    TestCasesRows.Add(new TestCaseTableRow(tc).LinesOfCode);
                }

                int currentLine = 96;

                for (int i = 70; i < htmlDoc.Count; ++i)
                {
                    if (htmlDoc[i].Contains("<!--$start_table_rows-->"))
                    {
                        currentLine = i + 1;
                        break;
                    }
                }

                for (int i = 0; i < TestCasesRows.Count; ++i)
                {
                    for (int j = 0; j < TestCasesRows[i].Count; ++j)
                    {
                        htmlDoc.Insert(currentLine, TestCasesRows[i][j]);
                        ++currentLine;
                    }
                }
            }

            for (int i = 0; i < htmlDoc.Count; ++i)
            {
                if (htmlDoc[i].Contains("$test_plan_name"))
                {
                    htmlDoc[i] = "\t\t\t\t\t<h1 class=\"mt - 4\">" + TestPlan.Name + "</h1><br>";
                }

                if (htmlDoc[i].Contains("$test_plan_introduction"))
                {
                    htmlDoc[i] = "\t\t\t\t\t\t\t<li class=\"breadcrumb - item active\">" + TestPlan.Introduction + "</li>";
                }

                if (htmlDoc[i].Contains("$test_plan_environment"))
                {
                    htmlDoc[i] = "\t\t\t\t\t\t\t<li class=\"breadcrumb - item active\">" + TestPlan.SetupEnvironment + "</li>";
                }

                if (htmlDoc[i].Contains("$test_plan_scope"))
                {
                    htmlDoc[i] = "\t\t\t\t\t\t\t<li class=\"breadcrumb - item active\">" + TestPlan.Scope + "</li>";
                }

                if (htmlDoc[i].Contains("$test_plan_regression"))
                {
                    htmlDoc[i] = "\t\t\t\t\t\t\t<li class=\"breadcrumb - item active\">" + TestPlan.Regression + "</li>";
                }

                if (htmlDoc[i].Contains("$test_plan_fixes"))
                {
                    htmlDoc[i] = "\t\t\t\t\t\t\t<li class=\"breadcrumb - item active\">" + TestPlan.Fixes + "</li>";
                }
            }

            using (StreamWriter sw = new StreamWriter("..\\..\\..\\template\\report.html"))
            {
                foreach (string line in htmlDoc)
                {
                    sw.WriteLine(line);
                }
            }
        }