示例#1
0
        public void TestAEFPDefaultConfig()
        {
            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);
            WSConnection connection = new WSConnection()
            {
                Url = "http://tests/CAST-RESTAPI/rest/",
                Login = "******",
                Password = "******",
                IsActive = true,
                Name = "Default"
            };
            reportData.SnapshotExplorer = new SnapshotBLLStub(connection, reportData.CurrentSnapshot);

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

            var expectedData = new List<string>();
            expectedData.AddRange(new List<string> { "Element Type", "Function Name", "Object Type", "Technology", "Module Name", "Object Name", "AEP", "Status", "Complexity Factor", "Updated Artifacts"});
            expectedData.AddRange(new List<string> { "Data Function", "COI5F21", "Cobol File Link", "Cobol", "Presales", "[c:\\jenkins7_slave\\workspace\\CAIP_Trunk_TestE2E_CSS_ADG\\Work\\CAST\\Deploy\\Big Ben\\Presales\\PROG-BATCH].COCPB10.COI5F21", "5", "Added", "1.0", "-"});
            expectedData.AddRange(new List<string> { "Data Function", "CSI0F61", "Cobol File Link", "Cobol", "Presales", "[c:\\jenkins7_slave\\workspace\\CAIP_Trunk_TestE2E_CSS_ADG\\Work\\CAST\\Deploy\\Big Ben\\Presales\\PROG-BATCH].CSVAB482.CSI0F61", "5", "Added", "1.0", "-" });
            expectedData.AddRange(new List<string> { "Data Function", "CSI1F41", "Cobol File Link", "Cobol", "Presales", "[c:\\jenkins7_slave\\workspace\\CAIP_Trunk_TestE2E_CSS_ADG\\Work\\CAST\\Deploy\\Big Ben\\Presales\\PROG-BATCH].CSVAB482.CSI1F41", "5", "Added", "1.0", "-" });
            expectedData.AddRange(new List<string> { "Data Function", "CSI1F51", "Cobol File Link", "Cobol", "Presales", "[c:\\jenkins7_slave\\workspace\\CAIP_Trunk_TestE2E_CSS_ADG\\Work\\CAST\\Deploy\\Big Ben\\Presales\\PROG-BATCH].CSVAB482.CSI1F51", "5", "Modified", "1.0", "-" });
            expectedData.AddRange(new List<string> { "Data Function", "CSI1F62", "Cobol File Link", "Cobol", "Presales", "[c:\\jenkins7_slave\\workspace\\CAIP_Trunk_TestE2E_CSS_ADG\\Work\\CAST\\Deploy\\Big Ben\\Presales\\PROG-BATCH].CSVAB482.CSI1F62", "5", "Modified", "1.0", "-" });
            expectedData.AddRange(new List<string> {"Data Function", "EKPO", "SAP unresolved Table", "SAP SQL", "Abap_castpubs", "unresolvedObjects/SAP_TABLE/EKPO", "3", "Deleted", "0.4", "-"});
            expectedData.AddRange(new List<string> {"Data Function", "COI1F91", "Cobol File Link", "Cobol", "Presales", "[c:\\jenkins7_slave\\workspace\\CAIP_Trunk_TestE2E_CSS_ADG\\Work\\CAST\\Deploy\\Big Ben\\Presales\\PROG-BATCH].COVAB24.COI1F91", "2", "Deleted", "0.4", "-"});
            expectedData.AddRange(new List<string> { "Data Function", "COI2F01", "Cobol File Link", "Cobol", "Presales", "[c:\\jenkins7_slave\\workspace\\CAIP_Trunk_TestE2E_CSS_ADG\\Work\\CAST\\Deploy\\Big Ben\\Presales\\PROG-BATCH].COVAB24.COI2F01", "2", "Deleted", "0.4", "-"});
            expectedData.AddRange(new List<string> { "Data Function", "COI2F11", "Cobol File Link", "Cobol", "Presales", "[c:\\jenkins7_slave\\workspace\\CAIP_Trunk_TestE2E_CSS_ADG\\Work\\CAST\\Deploy\\Big Ben\\Presales\\PROG-BATCH].COVAB24.COI2F11", "2", "Deleted", "0.4", "-" });
            expectedData.AddRange(new List<string> { "Data Function", "COI1F71", "Cobol File Link", "Cobol", "Presales", "[c:\\jenkins7_slave\\workspace\\CAIP_Trunk_TestE2E_CSS_ADG\\Work\\CAST\\Deploy\\Big Ben\\Presales\\PROG-BATCH].COVAB18.COI1F71", "1", "Modified", "0.25", "0" });
            TestUtility.AssertTableContent(table, expectedData, 10, 11);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#8
0
        public void TestLimitCount()
        {
            CastDate currentDate = new CastDate {
                Time = 1492984800000
            };
            CastDate previousDate = new CastDate {
                Time = 1492380000000
            };
            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,
                                                                             @".\Data\ModulesCoCRA.json", @".\Data\PreviousBCTCmodules.json", "AED/applications/3/snapshots/3", "Snap3_CAIP-8.2.4_RG-1.4.1", "8.2.4", previousDate);

            var component = new ListOfAllVersions();
            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> {
                "Snapshot Label", "Snapshot Date"
            });
            expectedData.AddRange(new List <string> {
                "8.3.ra", "Apr 24 2017"
            });
            TestUtility.AssertTableContent(table, expectedData, 2, 2);
            Assert.IsTrue(table.HasColumnHeaders);
        }
示例#9
0
        public void TestTwoSnapshots()
        {
            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 TQI();
            Dictionary <string, string> config = new Dictionary <string, string>();
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Statistics", "Current score", "Previous score"
            });
            expectedData.AddRange(new List <string> {
                "TQI", "2.78", "2.73"
            });
            TestUtility.AssertTableContent(table, expectedData, 3, 2);
        }
示例#10
0
        public void TestTwoSnapshots()
        {
            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 TrendTechDebt();
            Dictionary <string, string> config = new Dictionary <string, string>();
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                " ", "Debt Removed ($)", "Debt Added ($)", "Debt ($)"
            });
            expectedData.AddRange(new List <string> {
                "42755", "-685.12", "6394.5", "261025.12"
            });
            expectedData.AddRange(new List <string> {
                "42756", "-23599.5", "1946.25", "236647.5"
            });
            TestUtility.AssertTableContent(table, expectedData, 4, 3);

            Assert.IsNull(table.GraphOptions);
        }
示例#11
0
        public void TestShortHeaders()
        {
            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 TechnicalDebt();
            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> {
                "Name", "Value"
            });
            expectedData.AddRange(new List <string> {
                "Debt", "236,648"
            });
            expectedData.AddRange(new List <string> {
                "Debt Added", "1,946"
            });
            expectedData.AddRange(new List <string> {
                "Debt Removed", "23,600"
            });
            TestUtility.AssertTableContent(table, expectedData, 2, 3);
        }
示例#12
0
        public void TestShortHeader()
        {
            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 TQIbyModule();
            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> {
                " ", "Cur. TQI", "Prev. TQI", "Var"
            });
            expectedData.AddRange(new List <string> {
                "AAD-Admin", "2.77", "n/a", "n/a"
            });
            expectedData.AddRange(new List <string> {
                "AED-Admin", "2.91", "n/a", "n/a"
            });
            expectedData.AddRange(new List <string> {
                "ReportGenerator", "2.79", "n/a", "n/a"
            });
            TestUtility.AssertTableContent(table, expectedData, 4, 4);
            Assert.IsTrue(table.HasColumnHeaders);
        }
示例#13
0
        public void TestTwoSnapshot()
        {
            CastDate currentDate = new CastDate {
                Time = 1492984800000
            };
            CastDate previousDate = new CastDate {
                Time = 1492380000000
            };
            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,
                                                                             @".\Data\ModulesCoCRA.json", @".\Data\PreviousBCTCmodules.json", "AED/applications/3/snapshots/3", "Snap3_CAIP-8.2.4_RG-1.4.1", "8.2.4", previousDate);

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

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                " ", "Current TQI", "Previous TQI", "Variation"
            });
            expectedData.AddRange(new List <string> {
                "AAD-Admin", "2.77", "2.76", "+0.64 %"
            });
            expectedData.AddRange(new List <string> {
                "AED-Admin", "2.91", "2.92", "-0.50 %"
            });
            expectedData.AddRange(new List <string> {
                "ReportGenerator", "2.79", "2.65", "+5.29 %"
            });
            TestUtility.AssertTableContent(table, expectedData, 4, 4);
            Assert.IsTrue(table.HasColumnHeaders);
        }
示例#14
0
        public void TestAEFPModifiedTransactional()
        {
            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);
            WSConnection connection = new WSConnection()
            {
                Url = "http://tests/CAST-RESTAPI/rest/",
                Login = "******",
                Password = "******",
                IsActive = true,
                Name = "Default"
            };
            reportData.SnapshotExplorer = new SnapshotBLLStub(connection, reportData.CurrentSnapshot);

            var component = new AEFPList();
            Dictionary<string, string> config = new Dictionary<string, string>
            {
                { "TYPE", "TF"},
                { "STATUS", "MODIFIED"}
            };
            var table = component.Content(reportData, config);

            var expectedData = new List<string>();
            expectedData.AddRange(new List<string> { "Function Name", "Object Type", "Technology", "Module Name", "Object Name", "AEP", "Status", "Complexity Factor", "Updated Artifacts" });
            expectedData.AddRange(new List<string> { "ERCO0CP2", "JCL Job", "JCL", "Presales", "[c:\\jenkins7_slave\\workspace\\CAIP_Trunk_TestE2E_CSS_ADG\\Work\\CAST\\Deploy\\Big Ben\\Presales\\JCL].ERCO0CP2", "4", "Modified", "0.5", "1" });
            expectedData.AddRange(new List<string> { "ERCO0MPY", "JCL Job", "JCL", "Presales", "[c:\\jenkins7_slave\\workspace\\CAIP_Trunk_TestE2E_CSS_ADG\\Work\\CAST\\Deploy\\Big Ben\\Presales\\JCL].ERCO0MPY", "4", "Modified", "0.5", "0" });
            expectedData.AddRange(new List<string> { "ERCS0NPA", "JCL Job", "JCL", "Presales", "[c:\\jenkins7_slave\\workspace\\CAIP_Trunk_TestE2E_CSS_ADG\\Work\\CAST\\Deploy\\Big Ben\\Presales\\JCL].ERCS0NPA", "4", "Modified", "0.5", "2" });
            TestUtility.AssertTableContent(table, expectedData, 9, 4);
        }
示例#15
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);
        }
示例#16
0
        public void TestAnotherBC()
        {
            CastDate currentDate = new CastDate {
                Time = 1492984800000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("CoCRestAPI",
                                                                             null, @".\Data\CurrentBCtechno.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 TQIbyTechno();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "ID", "60016" }
            };
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Techno", "Security"
            });
            expectedData.AddRange(new List <string> {
                ".NET", "3.21"
            });
            expectedData.AddRange(new List <string> {
                "JEE", "3.31"
            });
            expectedData.AddRange(new List <string> {
                "SQL Analyzer", "3.12"
            });
            TestUtility.AssertTableContent(table, expectedData, 2, 4);
            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);
        }
示例#18
0
        public void TestCriticalUnchangedModule()
        {
            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);

            var component = new CastReporting.Reporting.Block.Table.ViolationsListByBC();
            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "COUNT", "ALL" },
                { "BCID", "60016" },
                { "FILTER", "UNCHANGED" },
                { "VIOLATIONS", "CRITICAL" },
                { "MODULE", "JSPBookDemo" }
            };

            Module mod = new Module()
            {
                Name = "JSPBookDemo",
                Href = "AED/modules/6/snapshots/6"
            };

            reportData.CurrentSnapshot.Modules = new List <Module> {
                mod
            };

            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Violation Status", "PRI", "Exclusion Status", "Action Status", "Rule Name", "Business criterion name", "Object Name", "Object Status"
            });
            expectedData.AddRange(new List <string> {
                "unchanged", "1,288", "n/a", "n/a", "Avoid cyclical calls and inheritances between namespaces content", "Security", "CastReporting.Reporting.Helper", "unchanged"
            });
            expectedData.AddRange(new List <string> {
                "unchanged", "168", "n/a", "n/a", "Avoid cyclical calls and inheritances between namespaces content", "Security", "CastReporting.Mediation.Interfaces", "unchanged"
            });
            expectedData.AddRange(new List <string> {
                "unchanged", "168", "n/a", "n/a", "Avoid cyclical calls and inheritances between namespaces content", "Security", "CastReporting.Reporting.Builder", "unchanged"
            });
            expectedData.AddRange(new List <string> {
                "unchanged", "112", "n/a", "n/a", "Avoid cyclical calls and inheritances between namespaces content", "Security", "CastReporting.Reporting", "unchanged"
            });
            TestUtility.AssertTableContent(table, expectedData, 8, 5);
        }
        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 TestOrderByDegradationVariation()
        {
            CastDate currentDate = new CastDate {
                Time = 1484953200000
            };
            CastDate previousDate = new CastDate {
                Time = 1484866800000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("ReportGenerator",
                                                                             null, @".\Data\CurrentBCTC.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2", currentDate,
                                                                             null, @".\Data\PreviousBCTC.json", "AED/applications/3/snapshots/3", "PreVersion 1.4.1 before release", "V-1.4.1", previousDate);

            reportData = TestUtility.AddCriticalRuleViolations(reportData, 60011, @".\Data\cc60011.json", @".\Data\cc60011previous.json");
            reportData = TestUtility.AddNonCriticalRuleViolations(reportData, 60011, @".\Data\nc60011.json", @".\Data\nc60011previous.json");

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

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Rule Name", "Current Violations", "Previous Violations", "Evolution", "Grade", "Grade Evolution"
            });
            expectedData.AddRange(new List <string> {
                "Avoid hiding static Methods", "63", "3", "+2,000 %", "1.56", "-52 %"
            });
            TestUtility.AssertTableContent(table, expectedData, 6, 2);
        }
        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 TestTwoSnapshotNoShowPrevious()
        {
            CastDate currentDate = new CastDate {
                Time = 1484953200000
            };
            CastDate previousDate = new CastDate {
                Time = 1484866800000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("ReportGenerator",
                                                                             null, @".\Data\CurrentBCTC.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2", currentDate,
                                                                             null, @".\Data\PreviousBCTC.json", "AED/applications/3/snapshots/3", "PreVersion 1.4.1 before release", "V-1.4.1", previousDate);

            var component = new CriticalVIolationByApplication();
            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", "Robu.", "Efcy", "Secu.", "Trans.", "Chang."
            });
            expectedData.AddRange(new List <string> {
                "Current Version", "75", "14", "43", "8", "6", "31"
            });
            expectedData.AddRange(new List <string> {
                "   Added", "0", "+5", "0", "0", "+3", "0"
            });
            expectedData.AddRange(new List <string> {
                "   Removed", "-22", "-2", "-2", "-1", "-1", "-19"
            });
            TestUtility.AssertTableContent(table, expectedData, 7, 4);
            Assert.IsTrue(table.HasColumnHeaders);
        }
示例#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 TestTwoSnapshots()
        {
            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 TrendHealthFactor();
            Dictionary <string, string> config = new Dictionary <string, string>();
            var table = component.Content(reportData, config);

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                " ", "Trans.", "Chang.", "Robu.", "Efcy", "Secu.", "LoC"
            });
            expectedData.AddRange(new List <string> {
                "42755", "2.82", "1.93", "3.15", "2.6", "3.13", "22347"
            });
            expectedData.AddRange(new List <string> {
                "42756", "2.92", "1.93", "3.19", "2.59", "3.17", "21261"
            });
            TestUtility.AssertTableContent(table, expectedData, 7, 3);

            Assert.IsNull(table.GraphOptions);
        }
示例#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);
        }
示例#26
0
        public void TestLimitCount()
        {
            CastDate currentDate = new CastDate {
                Time = 1484953200000
            };
            CastDate previousDate = new CastDate {
                Time = 1484866800000
            };
            ReportData reportData = TestUtility.PrepareApplicationReportData("ReportGenerator",
                                                                             null, @".\Data\CurrentBCTC.json", "AED/applications/3/snapshots/6", "PreVersion 1.5.0 sprint 2 shot 2", "V-1.5.0_Sprint 2_2", currentDate,
                                                                             null, @".\Data\PreviousBCTC.json", "AED/applications/3/snapshots/3", "PreVersion 1.4.1 before release", "V-1.4.1", previousDate);

            reportData = TestUtility.AddCriticalRuleViolations(reportData, 60011, @".\Data\cc60011.json", @".\Data\cc60011previous.json");
            reportData = TestUtility.AddNonCriticalRuleViolations(reportData, 60011, @".\Data\nc60011.json", @".\Data\nc60011previous.json");

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

            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Rule Name", "# Violations"
            });
            expectedData.AddRange(new List <string> {
                "Avoid unreferenced Tables", "209"
            });
            TestUtility.AssertTableContent(table, expectedData, 2, 2);
        }
示例#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 TestLargeContent()
        {
            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);

            reportData.Parameter.ApplicationSizeLimitSupLarge  = 3000000;
            reportData.Parameter.ApplicationSizeLimitSupMedium = 500000;
            reportData.Parameter.ApplicationSizeLimitSupSmall  = 10000;

            Snapshot          snap = reportData.Application.Snapshots.FirstOrDefault();
            ApplicationResult res  = snap?.SizingMeasuresResults.FirstOrDefault(_ => _.Reference.Key == 10151);

            if (res != null)
            {
                res.DetailResult.Value = 1000000;
            }

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

            Assert.AreEqual("large", str);
        }
示例#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);
        }
示例#30
0
        public void TestAEFPBadVersion()
        {
            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);
            reportData.ServerVersion = "1.8.0.456";
            WSConnection connection = new WSConnection
            {
                Url = "http://tests/CAST-RESTAPI/rest/",
                Login = "******",
                Password = "******",
                IsActive = true,
                Name = "Default"
            };
            reportData.SnapshotExplorer = new SnapshotBLLStub(connection, reportData.CurrentSnapshot);

            var component = new AEFPList();
            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> { "Element Type", "Function Name", "Object Type", "Technology", "Module Name", "Object Name", "AEP", "Status", "Complexity Factor", "Updated Artifacts" });
            expectedData.AddRange(new List<string> { "No data found", string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty });
            TestUtility.AssertTableContent(table, expectedData, 10, 2);
        }