Пример #1
0
        private void Init(IBuildDetail buildDetail, string flavour, string platform, IEnumerable<ITestRun> testRuns, ICoverageAnalysisManager coverageAnalysisManager)
        {
            this.TestsFailed = testRuns.Select(run => run.Statistics.FailedTests).Sum();
            this.TestsPassed = testRuns.Select(run => run.Statistics.PassedTests).Sum();
            this.TestsTotal = testRuns.Select(run => run.Statistics.TotalTests).Sum();

            var configurationSummary = InformationNodeConverters.GetConfigurationSummary(buildDetail, flavour, platform);

            if (configurationSummary != null)
            {
                this.HasWarnings = configurationSummary.TotalCompilationWarnings > 0;
            }

            this.BuildFinished = buildDetail.BuildFinished;
            this.FinishTime = buildDetail.FinishTime;
            this.Status = BuildStatusConverter.Convert(buildDetail.Status);
            this.RequestedFor = buildDetail.RequestedFor;
            this.StartTime = buildDetail.StartTime;
            this.CodeCoverage = GetCodeCoverage(buildDetail, coverageAnalysisManager);
        }
Пример #2
0
        public int? GetCodeCoverage(IBuildDetail buildDetail, ICoverageAnalysisManager analysisManager)
        {
            IBuildCoverage[] queryBuildCoverage = analysisManager.QueryBuildCoverage(buildDetail.Uri.ToString(), CoverageQueryFlags.Modules);
            int blocksCovered = 0;
            int blocksNotCovered = 0;

            foreach (var coverage in queryBuildCoverage)
            {
                foreach (var moduleInfo in coverage.Modules)
                {
                    blocksCovered += moduleInfo.Statistics.BlocksCovered;
                    blocksNotCovered += moduleInfo.Statistics.BlocksNotCovered;
                }
            }
            if (blocksCovered + blocksNotCovered == 0)
            {
                return null;
            }
            return 100 * blocksCovered / (blocksCovered + blocksNotCovered);
        }
Пример #3
0
        public int?GetCodeCoverage(Build buildDetail, ICoverageAnalysisManager analysisManager)
        {
            IBuildCoverage[] queryBuildCoverage = analysisManager.QueryBuildCoverage(buildDetail.Uri.ToString(), CoverageQueryFlags.Modules);
            int blocksCovered    = 0;
            int blocksNotCovered = 0;

            foreach (var coverage in queryBuildCoverage)
            {
                foreach (var moduleInfo in coverage.Modules)
                {
                    blocksCovered    += moduleInfo.Statistics.BlocksCovered;
                    blocksNotCovered += moduleInfo.Statistics.BlocksNotCovered;
                }
            }
            if (blocksCovered + blocksNotCovered == 0)
            {
                return(null);
            }
            return(100 * blocksCovered / (blocksCovered + blocksNotCovered));
        }
Пример #4
0
 public Tfs2010BuildInfo(IBuildDetail buildDetail, string flavour, string platform, IEnumerable<ITestRun> testRuns, ICoverageAnalysisManager coverageAnalysisManager)
 {
     this.Init(buildDetail, flavour, platform, testRuns, coverageAnalysisManager);
 }
Пример #5
0
        private void Init(Build buildDetail, string flavour, string platform, IEnumerable <ITestRun> testRuns, ICoverageAnalysisManager coverageAnalysisManager)
        {
            var testRunList = testRuns as IList <ITestRun> ?? testRuns.ToList();

            this.TestsFailed = testRunList.Select(run => run.Statistics.FailedTests).Sum();
            this.TestsPassed = testRunList.Select(run => run.Statistics.PassedTests).Sum();
            this.TestsTotal  = testRunList.Select(run => run.Statistics.TotalTests).Sum();

            this.FailedTests = new List <string>();
            foreach (ITestCaseResult testCaseResult in testRunList.SelectMany(testRun => testRun.QueryResultsByOutcome(TestOutcome.Failed)))
            {
                this.FailedTests.Add(testCaseResult.TestCaseTitle);
            }

            //var configurationSummary = InformationNodeConverters.GetConfigurationSummary(buildDetail, flavour, platform);

            //if (configurationSummary != null)
            //{
            //	this.HasWarnings = configurationSummary.TotalCompilationWarnings > 0;
            //}

            this.BuildFinished = buildDetail.FinishTime != null;
            this.FinishTime    = (buildDetail.FinishTime.HasValue ? buildDetail.FinishTime.Value.ToLocalTime() : (System.DateTime?)null);
            this.Status        = BuildStatusConverter.Convert(buildDetail.Status, buildDetail.Result);
            //this.CompilationStatus = BuildPhaseStatusConverter.Convert(buildDetail.CompilationStatus);
            //this.TestStatus = BuildPhaseStatusConverter.Convert(buildDetail.TestStatus);
            this.RequestedFor = buildDetail.RequestedFor.DisplayName;
            this.StartTime    = (buildDetail.StartTime.HasValue ? buildDetail.StartTime.Value.ToLocalTime() : (System.DateTime?)null);
            this.CodeCoverage = GetCodeCoverage(buildDetail, coverageAnalysisManager);
        }
Пример #6
0
 public TfsBuildInfo(Build buildDetail, string flavour, string platform, IEnumerable <ITestRun> testRuns, ICoverageAnalysisManager coverageAnalysisManager)
 {
     this.Init(buildDetail, flavour, platform, testRuns, coverageAnalysisManager);
 }