Ejemplo n.º 1
0
        public void BuildTestRun_MetricCollector_Test()
        {
            var writer    = new BuildTestRunDBMetricStorageWriter(this.config[SolutionConfigName.BIZ_DASHBOARD_DB_CONNECTION_STR].ToString());
            var collector = new BuildTestRunDBMetricCollector(writer, this.config);

            collector.CollectMetric();
        }
Ejemplo n.º 2
0
        public void BuildTestRun_Insert_Test()
        {
            var writer = new BuildTestRunDBMetricStorageWriter(this.config[SolutionConfigName.BIZ_DASHBOARD_DB_CONNECTION_STR].ToString());
            var detail = new Dictionary <string, object>();

            var runId = 100000;

            detail["VSO"]              = "testVSO";
            detail["Project"]          = "testProject";
            detail["BuildOrReleaseId"] = 100000;
            detail["RunId"]            = runId;
            detail["PassedTestNum"]    = 10;
            detail["TotalTestNum"]     = 10;
            detail["CreationDate"]     = DateTime.Parse("2017-01-01");

            var m1 = new Metric("TestRun", MetricType.TestRun, detail);

            writer.Write(m1);
            var tc = DBUtil.GetTestRun(this.config[SolutionConfigName.BIZ_DASHBOARD_DB_CONNECTION_STR].ToString(), runId);

            Assert.AreEqual(tc.VSO, "testVSO");
            Assert.AreEqual(tc.Project, "testProject");
            Assert.AreEqual(tc.BuildOrReleaseId, 100000);
            Assert.AreEqual(tc.RunId, runId);
            Assert.AreEqual(tc.PassedTestNum, 10);
            Assert.AreEqual(tc.TotalTestNum, 10);
            Assert.AreEqual(tc.CreationDate, DateTime.Parse("2017-01-01"));
        }
        public SalesIntelligenceMetricCollectorWorker(SolutionConfig config)
        {
            APIPingUtil.LanuchPingThread(config[SolutionConfigName.DASHBOARD_APP_INSIGHT_KEY].ToString());

            var dbConnString = config[SolutionConfigName.BIZ_DASHBOARD_DB_CONNECTION_STR].ToString();

            //Create build info collector
            var buildWriter = new OffcialBuildDBMetricStorageWriter(dbConnString);

            this.buildCollector = new OfficialBuildDBMetricCollector(buildWriter, config);

            //Create PR info collector
            var prWriter = new PullRequestDBMetricStorageWriter(dbConnString);

            this.prCollector = new PullRequestDBMetricCollector(prWriter, config);

            //Create TestCoverage info collector
            var testCoverageWriter = new TestCoverageDBMetricStorageWriter(dbConnString);

            this.testCoverageCollector = new TestCoverageDBMetricCollector(testCoverageWriter, config);

            //Create TestRun collector, it collect result of test run triggered by build
            var buildTestrunWriter = new BuildTestRunDBMetricStorageWriter(dbConnString);

            this.buildTestRunCollector = new BuildTestRunDBMetricCollector(buildTestrunWriter, config);

            //Create TestRun collector, it collect result of test run triggered by build
            var releaseTestRunWriter = new ReleaseTestRunDBMetricStorageWriter(dbConnString);

            this.releaseTestRunCollector = new ReleaseTestRunDBMetricCollector(releaseTestRunWriter, config);

            //Create vso work item collector, it collects CriticalError and Customer Incident manaully tracked in VSO
            var vsoWorkItemWriter = new VSOWorkItemDBMetricStorageWriter(dbConnString);

            this.vsoWorkItemCollector = new VSOWorkItemCollector(vsoWorkItemWriter, config);
        }