public void TestMetricsViolStats()
        {
            List <string> snapList = new List <string> {
                @".\Data\AADMultiCocApp3Snapshots.json", @".\Data\AADMultiCocApp37Snapshots.json"
            };
            List <string> snapResultsList = new List <string> {
                @".\Data\AADMultiCocApp3SnapshotsResults.json", @".\Data\AADMultiCocApp37SnapshotsResults.json"
            };
            ReportData reportData = TestUtility.PrepaPortfolioReportData(@".\Data\AADMultiCocApplications.json", snapList, snapResultsList);

            var component = new PortfolioGenericTable();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "COL1", "METRICS" },
                { "ROW1", "APPLICATIONS" },
                { "METRICS", "VIOLATION|CRITICAL_VIOLATION" },
                { "APPLICATIONS", "EACH" }
            };

            var table        = component.Content(reportData, config);
            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Applications", "Number of violations to critical quality rules per KLOC (average)"
            });
            expectedData.AddRange(new List <string> {
                "ReportGenerator", "1"
            });
            expectedData.AddRange(new List <string> {
                "AADAEDAdmin", "2"
            });
            TestUtility.AssertTableContent(table, expectedData, 2, 3);
        }
Ejemplo n.º 2
0
        public void TestTwoSnapshot()
        {
            CastDate currentDate = new CastDate {
                Time = 1496959200000
            };
            CastDate previousDate = new CastDate {
                Time = 1484953200000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("CoCRestAPI",
                                                                             null, @".\Data\cocraFuncWeight.json", "AED/applications/3/snapshots/5", "Snap5_CAIP-8.3ra2_RG-1.6a", "8.3.ra2", currentDate,
                                                                             null, @".\Data\cocraFuncWeightPrevious.json", "AED/applications/3/snapshots/4", "Snap4_CAIP-8.3ra_RG-1.5.a", "8.3.ra", previousDate);

            var component = new FunctionalWeightEvolution();
            Dictionary <string, string> config = new Dictionary <string, string>();
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Name", "Current", "Previous", "Evolution", "% Evolution"
            });
            expectedData.AddRange(new List <string> {
                "Automated Function Points", "5,667", "1,991", "+3,676", "+185 %"
            });
            expectedData.AddRange(new List <string> {
                "Decision Points (total CC)", "11,964", "6,814", "+5,150", "+75.6 %"
            });
            expectedData.AddRange(new List <string> {
                "Backfired Function Points", "418", "420", "-2", "-0.41 %"
            });
            TestUtility.AssertTableContent(table, expectedData, 5, 4);
            Assert.IsTrue(table.HasColumnHeaders);
        }
Ejemplo n.º 3
0
        public void TestLimitCount()
        {
            CastDate currentDate = new CastDate {
                Time = 1484953200000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("ReportGenerator",
                                                                             null, @".\Data\RuleListBCTC.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2", currentDate,
                                                                             null, null, null, null, null, null);

            reportData.RuleExplorer    = new RuleBLLStub();
            reportData.CurrentSnapshot = TestUtility.AddSameTechCritRulesViolations(reportData.CurrentSnapshot, @".\Data\TechCrit61009Violations.json");

            var component = new RulesList();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "PAR", "60011" },
                { "COUNT", "2" }
            };
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Criticality", "Weight", "Grade", "Technical Criterion", "Rule Name", "# Viol.", "Successful Checks"
            });
            expectedData.AddRange(new List <string> {
                "µ", "9", "3.56", "Complexity - Algorithmic and Control Structure Complexity", "Action Mappings should have few forwards", "58", "3,117"
            });
            expectedData.AddRange(new List <string> {
                "", "45", "3.56", "Complexity - Algorithmic and Control Structure Complexity", "Avoid accessing data by using the position and length", "123", "1,234"
            });
            TestUtility.AssertTableContent(table, expectedData, 7, 3);
        }
Ejemplo n.º 4
0
        public void TestDecreaseNumberNoPrevious()
        {
            CastDate currentDate = new CastDate {
                Time = 1484953200000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("ReportGenerator",
                                                                             null, @".\Data\current.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2", currentDate,
                                                                             null, null, null, null, null, null);

            reportData.RuleExplorer = new RuleBLLStub();

            TestUtility.AddSameTechCritRulesViolations(reportData.CurrentSnapshot, @".\Data\current.json");

            var component = new CastReporting.Reporting.Block.Table.RulesListLargestVariation();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "BCID", "60016" },
                { "VARIATION", "decrease" },
                { "DATA", "number" },
                { "COUNT", "3" }
            };
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Weight", "Variation", "Rule Name"
            });
            expectedData.AddRange(new List <string> {
                "No enabled item", "", ""
            });
            TestUtility.AssertTableContent(table, expectedData, 3, 2);
        }
Ejemplo n.º 5
0
        public void TestContent()
        {
            CastDate currentDate = new CastDate {
                Time = 1484953200000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("ReportGenerator",
                                                                             null, @".\Data\RuleListBCTC.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2", currentDate,
                                                                             null, null, null, null, null, null);

            reportData = TestUtility.AddQIBusinessCriteriaConfiguration(reportData, @".\Data\QIBusinessCriteriaConf.json");
            reportData.RuleExplorer    = new RuleBLLStub();
            reportData.CurrentSnapshot = TestUtility.AddSameTechCritRulesViolations(reportData.CurrentSnapshot, @".\Data\TechCrit61009Violations.json");

            var component = new CastReporting.Reporting.Block.Table.TCImprovementOpportunity();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "PAR", "60011" }
            };
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Technical criterion name", "# Violations", "Total Checks", "Grade"
            });
            expectedData.AddRange(new List <string> {
                "Complexity - Algorithmic and Control Structure Complexity", "443", "17,056", "3.56"
            });
            TestUtility.AssertTableContent(table, expectedData, 4, 2);
        }
Ejemplo n.º 6
0
        public void TestKLocs()
        {
            CastDate currentDate = new CastDate {
                Time = 1492984800000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("CoCRestAPI",
                                                                             @".\Data\ModulesCoCRA.json", @".\Data\CurrentTechSizeResultsModTechno.json", "AED/applications/3/snapshots/4", "Snap4_CAIP-8.3ra_RG-1.5.a", "8.3.ra", currentDate,
                                                                             null, null, null, null, null, null);

            var component = new LocByModule();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "FORMAT", "KLOC" }
            };
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Module Name", "kLoC"
            });
            expectedData.AddRange(new List <string> {
                "AAD-Admin", "10"
            });
            expectedData.AddRange(new List <string> {
                "AED-Admin", "28"
            });
            expectedData.AddRange(new List <string> {
                "ReportGenerator", "24"
            });
            TestUtility.AssertTableContent(table, expectedData, 2, 4);
            Assert.IsTrue(table.HasColumnHeaders);
        }
        public void TestZoom()
        {
            CastDate currentDate = new CastDate {
                Time = 1484953200000
            };
            CastDate previousDate = new CastDate {
                Time = 1484866800000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("ReportGenerator",
                                                                             null, @".\Data\CurrentBCresults.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2", currentDate,
                                                                             null, @".\Data\PreviousBCresults.json", "AED/applications/3/snapshots/3", "PreVersion 1.4.1 before release", "V-1.4.1", previousDate);

            var component = new TrendCompliance();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "ZOOM", "3" }
            };
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                " ", "Prog.", "Arch.", "Doc.", "LoC"
            });
            expectedData.AddRange(new List <string> {
                "42755", "2.91", "2.1", "2.47", "22347"
            });
            expectedData.AddRange(new List <string> {
                "42756", "2.93", "2.1", "2.65", "21261"
            });
            TestUtility.AssertTableContent(table, expectedData, 5, 3);

            Assert.AreEqual(-0.9, table.GraphOptions.AxisConfiguration.VerticalAxisMinimal);
            Assert.AreEqual(6, table.GraphOptions.AxisConfiguration.VerticalAxisMaximal);
        }
Ejemplo n.º 8
0
        public void TestOneSnapshot()
        {
            CastDate currentDate = new CastDate {
                Time = 1492984800000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("CoCRestAPI",
                                                                             @".\Data\ModulesCoCRA.json", @".\Data\CurrentBCTCmodules.json", "AED/applications/3/snapshots/4", "Snap4_CAIP-8.3ra_RG-1.5.a", "8.3.ra", currentDate,
                                                                             null, null, null, null, null, null);

            var component = new HFbyModule();
            Dictionary <string, string> config = new Dictionary <string, string>();
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                " ", "TQI", "Robustness", "Efficiency", "Security", "Transferability", "Changeability"
            });
            expectedData.AddRange(new List <string> {
                "CoCRestAPI - 8.3.ra", " ", " ", " ", " ", " ", " "
            });
            expectedData.AddRange(new List <string> {
                "AAD-Admin", "2.77", "3.20", "1.83", "3.09", "2.89", "2.76"
            });
            expectedData.AddRange(new List <string> {
                "AED-Admin", "2.91", "3.41", "1.87", "3.24", "2.98", "2.89"
            });
            expectedData.AddRange(new List <string> {
                "ReportGenerator", "2.79", "3.18", "2.66", "3.21", "2.89", "1.87"
            });
            TestUtility.AssertTableContent(table, expectedData, 7, 5);
            Assert.IsTrue(table.HasColumnHeaders);
        }
        public void TestTypePath()
        {
            CastDate currentDate = new CastDate {
                Time = 1484953200000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("ReportGenerator",
                                                                             null, @".\Data\CurrentBCresults.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2", currentDate,
                                                                             null, null, null, null, null, null);
            WSConnection connection = new WSConnection()
            {
                Url      = "http://tests/CAST-RESTAPI/rest/",
                Login    = "******",
                Password = "******",
                IsActive = true,
                Name     = "Default"
            };

            reportData.SnapshotExplorer = new SnapshotBLLStub(connection, reportData.CurrentSnapshot);
            reportData.RuleExplorer     = new RuleBLLStub();
            var component = new CastReporting.Reporting.Block.Table.QualityRuleViolationsBookmarks();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "ID", "7740" },
                { "COUNT", "1" }
            };
            var table = component.Content(reportData, config);

            var expectedData = new List <string>
            {
                "Objects in violation for rule CWE-79: Avoid cross-site scripting DOM vulnerabilities",
                "",
                "Violation #1    CWE-79: Avoid cross-site scripting DOM vulnerabilities",
                "Object Name: aedtst_exclusions_central.adg_central_grades_std",
                "Object Type: MyObjType",
                "Violation Path #1",
                "File path: c:\\jenkins6_slave\\workspace\\caip_8.3.3_teste2e_css_adg\\work\\cast\\deploy\\jurassic park\\jspbookdemo\\pages\\newsales.jsp",
                "1197 : PreparedStatement statement = null;",
                "1198 :         try",
                "1199 :         {",
                "1200 :             statement = consolidatedConn.prepareStatement(insertMessage); ",
                "1201 :             statement.setString(1, message); ",
                "1202 :             statement.executeUpdate(); ",
                "1203 :         }",
                "File path: c:\\jenkins6_slave\\workspace\\CAIP_8.3.3_TestE2E_CSS_ADG\\Work\\CAST\\Deploy\\Jurassic Park\\WASecu\\WASecurityForm\\Default.aspx.cs",
                "1197 : PreparedStatement statement = null;",
                "1198 :         try",
                "1199 :         {",
                "1200 :             statement = consolidatedConn.prepareStatement(insertMessage); ",
                "1201 :             statement.setString(1, message); ",
                "1202 :             statement.executeUpdate(); ",
                "1203 :         }",
                ""
            };

            TestUtility.AssertTableContent(table, expectedData, 1, 23);

            var cellsProperties = table.CellsAttributes;

            Assert.AreEqual(20, cellsProperties.Count);
        }
        public void TestSample4()
        {
            // COL1=APPLICATIONS,ROW1=METRICS,METRICS=TECHNICAL_SIZING, APPLICATIONS=ALL,AGGREGATORS=SUM
            List <string> snapList = new List <string> {
                @".\Data\AADMultiCocApp3Snapshots.json", @".\Data\AADMultiCocApp37Snapshots.json"
            };
            List <string> snapResultsList = new List <string> {
                @".\Data\AADMultiCocApp3SnapshotsResults.json", @".\Data\AADMultiCocApp37SnapshotsResults.json"
            };
            ReportData reportData = TestUtility.PrepaPortfolioReportData(@".\Data\AADMultiCocApplications.json", snapList, snapResultsList);

            var component = new PortfolioGenericTable();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "COL1", "APPLICATIONS" },
                { "ROW1", "METRICS" },
                { "METRICS", "TECHNICAL_SIZING" },
                { "AGGREGATORS", "SUM" },
                { "APPLICATIONS", "ALL" }
            };

            var table        = component.Content(reportData, config);
            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Metrics", "2 Applications"
            });
            expectedData.AddRange(new List <string> {
                "Number of Code Lines", "67,589"
            });
            TestUtility.AssertTableContent(table, expectedData, 2, 2);
        }
        public void TestMetricsSeveralBCEachApp()
        {
            List <string> snapList = new List <string> {
                @".\Data\AADMultiCocApp3Snapshots.json", @".\Data\AADMultiCocApp37Snapshots.json"
            };
            List <string> snapResultsList = new List <string> {
                @".\Data\AADMultiCocApp3SnapshotsResults.json", @".\Data\AADMultiCocApp37SnapshotsResults.json"
            };
            ReportData reportData = TestUtility.PrepaPortfolioReportData(@".\Data\AADMultiCocApplications.json", snapList, snapResultsList);

            var component = new PortfolioGenericTable();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "COL1", "METRICS" },
                { "ROW1", "APPLICATIONS" },
                { "METRICS", "60014|60017|60013" },
                { "AGGREGATORS", "AVERAGE" },
                { "APPLICATIONS", "EACH" }
            };

            var table        = component.Content(reportData, config);
            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Applications", "Efficiency", "Total Quality Index", "Robustness"
            });
            expectedData.AddRange(new List <string> {
                "ReportGenerator", "2.65", "3.03", "3.32"
            });
            expectedData.AddRange(new List <string> {
                "AADAEDAdmin", "2.71", "3.30", "3.68"
            });
            TestUtility.AssertTableContent(table, expectedData, 4, 3);
        }
        public void TestSample2()
        {
            // ROW1=APPLICATIONS, COL1=CRITICAL_VIOLATIONS,CRITICAL_VIOLATIONS =ALL,APPLICATIONS=EACH
            List <string> snapList = new List <string> {
                @".\Data\AADMultiCocApp3Snapshots.json", @".\Data\AADMultiCocApp37Snapshots.json"
            };
            List <string> snapResultsList = new List <string> {
                @".\Data\AADMultiCocApp3SnapshotsResults.json", @".\Data\AADMultiCocApp37SnapshotsResults.json"
            };
            ReportData reportData = TestUtility.PrepaPortfolioReportData(@".\Data\AADMultiCocApplications.json", snapList, snapResultsList);

            var component = new PortfolioGenericTable();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "COL1", "CRITICAL_VIOLATIONS" },
                { "ROW1", "APPLICATIONS" },
                { "CRITICAL_VIOLATIONS", "ALL" },
                { "APPLICATIONS", "EACH" }
            };

            var table        = component.Content(reportData, config);
            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Applications", "Total Critical Violations", "Added Critical Violations", "Removed Critical Violations"
            });
            expectedData.AddRange(new List <string> {
                "ReportGenerator", "41", "0", "33"
            });
            expectedData.AddRange(new List <string> {
                "AADAEDAdmin", "80", "9", "174"
            });
            TestUtility.AssertTableContent(table, expectedData, 4, 3);
        }
        public void TestSample1()
        {
            // ROW1= APPLICATIONS,COL1=METRICS,METRICS=HEALTH_FACTOR, APPLICATIONS=EACH
            List <string> snapList = new List <string> {
                @".\Data\AADMultiCocApp3Snapshots.json", @".\Data\AADMultiCocApp37Snapshots.json"
            };
            List <string> snapResultsList = new List <string> {
                @".\Data\AADMultiCocApp3SnapshotsResults.json", @".\Data\AADMultiCocApp37SnapshotsResults.json"
            };
            ReportData reportData = TestUtility.PrepaPortfolioReportData(@".\Data\AADMultiCocApplications.json", snapList, snapResultsList);

            var component = new PortfolioGenericTable();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "COL1", "METRICS" },
                { "ROW1", "APPLICATIONS" },
                { "METRICS", "HEALTH_FACTOR" },
                { "APPLICATIONS", "EACH" }
            };

            var table        = component.Content(reportData, config);
            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Applications", "Transferability", "Changeability", "Robustness", "Efficiency", "Security"
            });
            expectedData.AddRange(new List <string> {
                "ReportGenerator", "3.07", "2.55", "3.32", "2.65", "3.30"
            });
            expectedData.AddRange(new List <string> {
                "AADAEDAdmin", "2.97", "3.37", "3.68", "2.71", "3.73"
            });
            TestUtility.AssertTableContent(table, expectedData, 6, 3);
        }
        public void TestViolAppli()
        {
            List <string> snapList = new List <string> {
                @".\Data\AADMultiCocApp3Snapshots.json", @".\Data\AADMultiCocApp37Snapshots.json"
            };
            List <string> snapResultsList = new List <string> {
                @".\Data\AADMultiCocApp3SnapshotsResults.json", @".\Data\AADMultiCocApp37SnapshotsResults.json"
            };
            ReportData reportData = TestUtility.PrepaPortfolioReportData(@".\Data\AADMultiCocApplications.json", snapList, snapResultsList);

            var component = new PortfolioGenericTable();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "COL1", "APPLICATIONS" },
                { "ROW1", "VIOLATIONS" },
                { "APPLICATIONS", "ReportGenerator" },
                { "VIOLATIONS", "ADDED|REMOVED" }
            };

            var table        = component.Content(reportData, config);
            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Violations", "ReportGenerator"
            });
            expectedData.AddRange(new List <string> {
                "Added Violations", "1,691"
            });
            expectedData.AddRange(new List <string> {
                "Removed Violations", "241"
            });
            TestUtility.AssertTableContent(table, expectedData, 2, 3);
        }
        public void TestDefectsToCriticalDistributionTwoSnapshots()
        {
            ReportData reportData = TestUtility.PrepaReportData("ReportGenerator",
                                                                null, @".\Data\Sample1Current.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2",
                                                                null, @".\Data\Sample1Previous.json", "AED/applications/3/snapshots/3", "PreVersion 1.4.1 before release", "V-1.4.1");

            reportData = TestUtility.AddApplicationComplexity(reportData, @".\Data\ComplexitySnapCurrent.json", @".\Data\ComplexitySnapPrevious.json");

            var component = new CastDistribution();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "PAR", "67030" }
            };
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Distribution of defects to critical diagnostic-based metrics per cost complexity", "Current", "Previous", "Evol.", "% Evol.", "% Total"
            });
            expectedData.AddRange(new List <string> {
                "Low Complexity", "221", "221", "0", "0 %", "37.2 %"
            });
            expectedData.AddRange(new List <string> {
                "Average Complexity", "270", "262", "+8", "+3.05 %", "45.5 %"
            });
            expectedData.AddRange(new List <string> {
                "High Complexity", "74", "73", "+1", "+1.37 %", "12.5 %"
            });
            expectedData.AddRange(new List <string> {
                "Extreme Complexity", "29", "26", "+3", "+11.5 %", "4.88 %"
            });
            TestUtility.AssertTableContent(table, expectedData, 6, 5);
            Assert.IsTrue(table.HasColumnHeaders);
        }
        public void TestCyclomaticComplexityTwoSnapshots()
        {
            ReportData reportData = TestUtility.PrepaReportData("ReportGenerator",
                                                                null, @".\Data\Sample1Current.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2",
                                                                null, @".\Data\Sample1Previous.json", "AED/applications/3/snapshots/3", "PreVersion 1.4.1 before release", "V-1.4.1");

            reportData = TestUtility.AddApplicationComplexity(reportData, @".\Data\ComplexitySnapCurrent.json", @".\Data\ComplexitySnapPrevious.json");

            var component = new CastDistribution();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "PAR", "65501" }
            };
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Cyclomatic Complexity Distribution", "Current", "Previous", "Evol.", "% Evol.", "% Total"
            });
            expectedData.AddRange(new List <string> {
                "Low Complexity", "8,305", "8,235", "+70", "+0.85 %", "88.6 %"
            });
            expectedData.AddRange(new List <string> {
                "Average Complexity", "838", "824", "+14", "+1.70 %", "8.94 %"
            });
            expectedData.AddRange(new List <string> {
                "High Complexity", "161", "159", "+2", "+1.26 %", "1.72 %"
            });
            expectedData.AddRange(new List <string> {
                "Extreme Complexity", "71", "68", "+3", "+4.41 %", "0.76 %"
            });
            TestUtility.AssertTableContent(table, expectedData, 6, 5);
            Assert.IsTrue(table.HasColumnHeaders);
        }
        public void TestCastComplexityTwoSnapshots()
        {
            ReportData reportData = TestUtility.PrepaReportData("ReportGenerator",
                                                                null, @".\Data\Sample1Current.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2",
                                                                null, @".\Data\Sample1Previous.json", "AED/applications/3/snapshots/3", "PreVersion 1.4.1 before release", "V-1.4.1");

            reportData = TestUtility.AddApplicationComplexity(reportData, @".\Data\ComplexitySnapCurrent.json", @".\Data\ComplexitySnapPrevious.json");

            var component = new CastDistribution();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "PAR", "67001" }
            };
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Cost Complexity distribution", "Current", "Previous", "Evol.", "% Evol.", "% Total"
            });
            expectedData.AddRange(new List <string> {
                "Low Complexity", "8,881", "8,824", "+57", "+0.65 %", "86.3 %"
            });
            expectedData.AddRange(new List <string> {
                "Average Complexity", "1,167", "1,140", "+27", "+2.37 %", "11.3 %"
            });
            expectedData.AddRange(new List <string> {
                "High Complexity", "172", "170", "+2", "+1.18 %", "1.67 %"
            });
            expectedData.AddRange(new List <string> {
                "Extreme Complexity", "71", "68", "+3", "+4.41 %", "0.69 %"
            });
            TestUtility.AssertTableContent(table, expectedData, 6, 5);
            Assert.IsTrue(table.HasColumnHeaders);
        }
        public void TestFourGLComplexityTwoSnapshots()
        {
            ReportData reportData = TestUtility.PrepaReportData("ReportGenerator",
                                                                null, @".\Data\Sample1Current.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2",
                                                                null, @".\Data\Sample1Previous.json", "AED/applications/3/snapshots/3", "PreVersion 1.4.1 before release", "V-1.4.1");

            reportData = TestUtility.AddApplicationComplexity(reportData, @".\Data\ComplexitySnapCurrent.json", @".\Data\ComplexitySnapPrevious.json");

            var component = new CastDistribution();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "PAR", "65601" }
            };
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "4GL Complexity Distribution", "Current", "Previous", "Evol.", "% Evol.", "% Total"
            });
            expectedData.AddRange(new List <string> {
                "Low Complexity", "0", "0", "0", "n/a", "n/a"
            });
            expectedData.AddRange(new List <string> {
                "Average Complexity", "0", "0", "0", "n/a", "n/a"
            });
            expectedData.AddRange(new List <string> {
                "High Complexity", "0", "0", "0", "n/a", "n/a"
            });
            expectedData.AddRange(new List <string> {
                "Extreme Complexity", "0", "0", "0", "n/a", "n/a"
            });
            TestUtility.AssertTableContent(table, expectedData, 6, 5);
            Assert.IsTrue(table.HasColumnHeaders);
        }
Ejemplo n.º 19
0
        public void TestOneSnapshot()
        {
            CastDate currentDate = new CastDate {
                Time = 1484953200000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("ReportGenerator",
                                                                             null, @".\Data\CurrentBCresults.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2", currentDate,
                                                                             null, null, null, null, null, null);
            var component = new TrendCompliance();
            Dictionary <string, string> config = new Dictionary <string, string>();
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                " ", "Prog.", "Arch.", "Doc.", "LoC"
            });
            expectedData.AddRange(new List <string> {
                "42756", "2.93", "2.1", "2.65", "21261"
            });
            expectedData.AddRange(new List <string> {
                "42756", "2.93", "2.1", "2.65", "21261"
            });
            TestUtility.AssertTableContent(table, expectedData, 5, 3);

            Assert.IsNull(table.GraphOptions);
        }
        public void TestCastComplexityNoPar()
        {
            ReportData reportData = TestUtility.PrepaReportData("ReportGenerator",
                                                                null, @".\Data\Sample1Current.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2",
                                                                null, null, null, null, null);

            reportData = TestUtility.AddApplicationComplexity(reportData, @".\Data\ComplexitySnapCurrent.json", null);

            var component = new CastDistribution();
            Dictionary <string, string> config = new Dictionary <string, string>();
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Cost Complexity distribution", "Current", "Previous", "Evol.", "% Evol.", "% Total"
            });
            expectedData.AddRange(new List <string> {
                "Low Complexity", "8,881", "n/a", "n/a", "n/a", "86.3 %"
            });
            expectedData.AddRange(new List <string> {
                "Average Complexity", "1,167", "n/a", "n/a", "n/a", "11.3 %"
            });
            expectedData.AddRange(new List <string> {
                "High Complexity", "172", "n/a", "n/a", "n/a", "1.67 %"
            });
            expectedData.AddRange(new List <string> {
                "Extreme Complexity", "71", "n/a", "n/a", "n/a", "0.69 %"
            });
            TestUtility.AssertTableContent(table, expectedData, 6, 5);
            Assert.IsTrue(table.HasColumnHeaders);
        }
Ejemplo n.º 21
0
        public void TestContent()
        {
            CastDate currentDate = new CastDate {
                Time = 1492984800000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("CoCRestAPI",
                                                                             @".\Data\ModulesCoCRA.json", @".\Data\CurrentTechSizeResultsModTechno.json", "AED/applications/3/snapshots/4", "Snap4_CAIP-8.3ra_RG-1.5.a", "8.3.ra", currentDate,
                                                                             null, null, null, null, null, null);

            reportData.CurrentSnapshot.Technologies = new[] { ".NET", "JEE", "SQL Analyzer" };

            var component = new TechnoLoCModule();
            Dictionary <string, string> config = new Dictionary <string, string>();
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "", ".NET", "JEE", "SQL Analyzer"
            });
            expectedData.AddRange(new List <string> {
                "AAD-Admin", "n/a", "7,970", "1,714"
            });
            expectedData.AddRange(new List <string> {
                "AED-Admin", "n/a", "5,341", "22,956"
            });
            expectedData.AddRange(new List <string> {
                "ReportGenerator", "24,446", "n/a", "n/a"
            });
            TestUtility.AssertTableContent(table, expectedData, 4, 4);
            Assert.IsTrue(table.HasColumnHeaders);
        }
        public void TestClassFanInComplexityTwoSnapshots()
        {
            ReportData reportData = TestUtility.PrepaReportData("ReportGenerator",
                                                                null, @".\Data\Sample1Current.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2",
                                                                null, @".\Data\Sample1Previous.json", "AED/applications/3/snapshots/3", "PreVersion 1.4.1 before release", "V-1.4.1");

            reportData = TestUtility.AddApplicationComplexity(reportData, @".\Data\ComplexitySnapCurrent.json", @".\Data\ComplexitySnapPrevious.json");

            var component = new CastDistribution();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "PAR", "66021" }
            };
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Class Fan-In Distribution", "Current", "Previous", "Evol.", "% Evol.", "% Total"
            });
            expectedData.AddRange(new List <string> {
                "Low Complexity", "527", "525", "+2", "+0.38 %", "89.9 %"
            });
            expectedData.AddRange(new List <string> {
                "Average Complexity", "18", "17", "+1", "+5.88 %", "3.07 %"
            });
            expectedData.AddRange(new List <string> {
                "High Complexity", "19", "19", "0", "0 %", "3.24 %"
            });
            expectedData.AddRange(new List <string> {
                "Extreme Complexity", "22", "21", "+1", "+4.76 %", "3.75 %"
            });
            TestUtility.AssertTableContent(table, expectedData, 6, 5);
            Assert.IsTrue(table.HasColumnHeaders);
        }
Ejemplo n.º 23
0
        public void TestNoConfig()
        {
            CastDate currentDate = new CastDate {
                Time = 1484953200000
            };
            CastDate previousDate = new CastDate {
                Time = 1484866800000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("ReportGenerator",
                                                                             null, @".\Data\current.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2", currentDate,
                                                                             null, @".\Data\previous.json", "AED/applications/3/snapshots/5", "PreVersion 1.4.0 sprint 1 shot 2", "V-1.4.0_Sprint 1_2", previousDate);

            reportData.RuleExplorer = new RuleBLLStub();

            TestUtility.AddSameTechCritRulesViolations(reportData.CurrentSnapshot, @".\Data\current.json");
            TestUtility.AddSameTechCritRulesViolations(reportData.PreviousSnapshot, @".\Data\previous.json");

            var component = new CastReporting.Reporting.Block.Table.RulesListLargestVariation();
            var table     = component.Content(reportData, null);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Weight", "Variation", "Rule Name"
            });
            expectedData.AddRange(new List <string> {
                "120", "25", "Avoid using 'System.err' and 'System.out' outside a try catch block"
            });
            expectedData.AddRange(new List <string> {
                "22", "4", "Track Classes referencing Database objects"
            });
            TestUtility.AssertTableContent(table, expectedData, 3, 3);
        }
        public void TestSizeDistributionTwoSnapshots()
        {
            ReportData reportData = TestUtility.PrepaReportData("ReportGenerator",
                                                                null, @".\Data\Sample1Current.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2",
                                                                null, @".\Data\Sample1Previous.json", "AED/applications/3/snapshots/3", "PreVersion 1.4.1 before release", "V-1.4.1");

            reportData = TestUtility.AddApplicationComplexity(reportData, @".\Data\ComplexitySnapCurrent.json", @".\Data\ComplexitySnapPrevious.json");

            var component = new CastDistribution();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "PAR", "65105" }
            };
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Size Distribution", "Current", "Previous", "Evol.", "% Evol.", "% Total"
            });
            expectedData.AddRange(new List <string> {
                "Low Complexity", "8,619", "8,558", "+61", "+0.71 %", "83.8 %"
            });
            expectedData.AddRange(new List <string> {
                "Average Complexity", "1,315", "1,298", "+17", "+1.31 %", "12.8 %"
            });
            expectedData.AddRange(new List <string> {
                "High Complexity", "321", "310", "+11", "+3.55 %", "3.12 %"
            });
            expectedData.AddRange(new List <string> {
                "Extreme Complexity", "36", "36", "0", "0 %", "0.35 %"
            });
            TestUtility.AssertTableContent(table, expectedData, 6, 5);
            Assert.IsTrue(table.HasColumnHeaders);
        }
Ejemplo n.º 25
0
        public void TestShortHeader()
        {
            CastDate currentDate = new CastDate {
                Time = 1484953200000
            };
            CastDate previousDate = new CastDate {
                Time = 1484866800000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("ReportGenerator",
                                                                             null, @".\Data\CurrentBCresults.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2", currentDate,
                                                                             null, @".\Data\PreviousBCresults.json", "AED/applications/3/snapshots/3", "PreVersion 1.4.1 before release", "V-1.4.1", previousDate);

            var component = new Compliance();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "HEADER", "SHORT" }
            };
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "", "Prog.", "Arch.", "Doc."
            });
            expectedData.AddRange(new List <string> {
                "V-1.5.0_Sprint 2_2", "2.93", "2.10", "2.65"
            });
            expectedData.AddRange(new List <string> {
                "V-1.4.1", "2.91", "2.10", "2.47"
            });
            expectedData.AddRange(new List <string> {
                "Variation", "+0.88 %", "-0.20 %", "+7.60 %"
            });
            TestUtility.AssertTableContent(table, expectedData, 4, 4);
        }
        public void TestReusebyCallDistributionTwoSnapshots()
        {
            ReportData reportData = TestUtility.PrepaReportData("ReportGenerator",
                                                                null, @".\Data\Sample1Current.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2",
                                                                null, @".\Data\Sample1Previous.json", "AED/applications/3/snapshots/3", "PreVersion 1.4.1 before release", "V-1.4.1");

            reportData = TestUtility.AddApplicationComplexity(reportData, @".\Data\ComplexitySnapCurrent.json", @".\Data\ComplexitySnapPrevious.json");

            var component = new CastDistribution();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "PAR", "66010" }
            };
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Reuse by Call Distribution", "Current", "Previous", "Evol.", "% Evol.", "% Total"
            });
            expectedData.AddRange(new List <string> {
                "Low Complexity", "9,413", "9,345", "+68", "+0.73 %", "91.5 %"
            });
            expectedData.AddRange(new List <string> {
                "Average Complexity", "666", "653", "+13", "+1.99 %", "6.47 %"
            });
            expectedData.AddRange(new List <string> {
                "High Complexity", "170", "163", "+7", "+4.29 %", "1.65 %"
            });
            expectedData.AddRange(new List <string> {
                "Extreme Complexity", "42", "41", "+1", "+2.44 %", "0.41 %"
            });
            TestUtility.AssertTableContent(table, expectedData, 6, 5);
            Assert.IsTrue(table.HasColumnHeaders);
        }
Ejemplo n.º 27
0
        public void TestOneSnapshot()
        {
            CastDate currentDate = new CastDate {
                Time = 1496959200000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("CoCRestAPI",
                                                                             null, @".\Data\cocraFuncWeight.json", "AED/applications/3/snapshots/5", "Snap5_CAIP-8.3ra2_RG-1.6a", "8.3.ra2", currentDate,
                                                                             null, null, null, null, null, null);

            var component = new FunctionalWeightEvolution();
            Dictionary <string, string> config = new Dictionary <string, string>();
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Name", "Current", "Previous", "Evolution", "% Evolution"
            });
            expectedData.AddRange(new List <string> {
                "Automated Function Points", "5,667", Constants.No_Value, Constants.No_Value, Constants.No_Value
            });
            expectedData.AddRange(new List <string> {
                "Decision Points (total CC)", "11,964", Constants.No_Value, Constants.No_Value, Constants.No_Value
            });
            expectedData.AddRange(new List <string> {
                "Backfired Function Points", "418", Constants.No_Value, Constants.No_Value, Constants.No_Value
            });
            TestUtility.AssertTableContent(table, expectedData, 5, 4);
            Assert.IsTrue(table.HasColumnHeaders);
        }
        public void TestViolationsToCriticalDistributionTwoSnapshots()
        {
            ReportData reportData = TestUtility.PrepaReportData("ReportGenerator",
                                                                null, @".\Data\Sample1Current.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2",
                                                                null, @".\Data\Sample1Previous.json", "AED/applications/3/snapshots/3", "PreVersion 1.4.1 before release", "V-1.4.1");

            reportData = TestUtility.AddApplicationComplexity(reportData, @".\Data\ComplexitySnapCurrent.json", @".\Data\ComplexitySnapPrevious.json");

            var component = new CastDistribution();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "PAR", "67020" }
            };
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Distribution of violations to critical diagnostic-based metrics per cost complexity", "Current", "Previous", "Evol.", "% Evol.", "% Total"
            });
            expectedData.AddRange(new List <string> {
                "Low Complexity", "227", "226", "+1", "+0.44 %", "32.4 %"
            });
            expectedData.AddRange(new List <string> {
                "Average Complexity", "308", "299", "+9", "+3.01 %", "43.9 %"
            });
            expectedData.AddRange(new List <string> {
                "High Complexity", "107", "106", "+1", "+0.94 %", "15.3 %"
            });
            expectedData.AddRange(new List <string> {
                "Extreme Complexity", "59", "55", "+4", "+7.27 %", "8.42 %"
            });
            TestUtility.AssertTableContent(table, expectedData, 6, 5);
            Assert.IsTrue(table.HasColumnHeaders);
        }
Ejemplo n.º 29
0
        public void TestLimitCount()
        {
            CastDate currentDate = new CastDate {
                Time = 1492984800000
            };
            CastDate previousDate = new CastDate {
                Time = 1484953200000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("CoCRestAPI",
                                                                             null, @".\Data\CurrentTechSizeResultsModTechno.json", "AED/applications/3/snapshots/4", "Snap4_CAIP-8.3ra_RG-1.5.a", "8.3.ra", currentDate,
                                                                             null, @".\Data\PreviousTechSizeResultsModTechno.json", "AED/applications/3/snapshots/3", "Snap3_CAIP-8.2.4_RG-1.4.1", "8.2.4", previousDate);

            reportData.CurrentSnapshot.Technologies  = new[] { ".NET", "JEE", "SQL Analyzer" };
            reportData.PreviousSnapshot.Technologies = new[] { ".NET", "JEE", "SQL Analyzer" };

            var component = new TechnoLoCEvolution();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "COUNT", "1" }
            };
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Name", "Current LoC", "Previous LoC", "Evolution", "% Evolution"
            });
            expectedData.AddRange(new List <string> {
                "SQL Analyzer", "24,670", "24,440", "+230", "+0.94 %"
            });
            TestUtility.AssertTableContent(table, expectedData, 5, 2);
            Assert.IsTrue(table.HasColumnHeaders);
        }
        public void TestMetricsFuncWeightTechDebtEachApp()
        {
            List <string> snapList = new List <string> {
                @".\Data\AADMultiCocApp3Snapshots.json", @".\Data\AADMultiCocApp37Snapshots.json"
            };
            List <string> snapResultsList = new List <string> {
                @".\Data\AADMultiCocApp3SnapshotsResults.json", @".\Data\AADMultiCocApp37SnapshotsResults.json"
            };
            ReportData reportData = TestUtility.PrepaPortfolioReportData(@".\Data\AADMultiCocApplications.json", snapList, snapResultsList);

            var component = new PortfolioGenericTable();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "COL1", "METRICS" },
                { "ROW1", "APPLICATIONS" },
                { "METRICS", "FUNCTIONAL_WEIGHT|TECHNICAL_DEBT" },
                { "APPLICATIONS", "EACH" }
            };

            var table        = component.Content(reportData, config);
            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Applications", "OMG-Compliant Automated Function Points", "Technical Debt"
            });
            expectedData.AddRange(new List <string> {
                "ReportGenerator", "477", "420,178"
            });
            expectedData.AddRange(new List <string> {
                "AADAEDAdmin", "13,732", "175,144"
            });
            TestUtility.AssertTableContent(table, expectedData, 3, 3);
        }