Exemple #1
0
        /// <summary>
        /// Publishes and uploads code coverage results
        /// </summary>
        /// <param name="summaryFilePath">The code coverage summary file path.</param>
        /// <param name="data">The code coverage data</param>
        public void PublishCodeCoverage(FilePath summaryFilePath, TFBuildPublishCodeCoverageData data)
        {
            if (summaryFilePath == null)
            {
                throw new ArgumentNullException(nameof(summaryFilePath));
            }

            var properties = data.GetProperties(_environment, summaryFilePath);

            WriteLoggingCommand("codecoverage.publish", properties, string.Empty);
        }
Exemple #2
0
        /// <summary>
        /// Publishes and uploads code coverage results
        /// </summary>
        /// <param name="summaryFilePath">The code coverage summary file path.</param>
        /// <param name="action">The configuration action for the code coverage data.</param>
        public void PublishCodeCoverage(FilePath summaryFilePath, Action <TFBuildPublishCodeCoverageData> action)
        {
            if (action == null)
            {
                throw new ArgumentNullException(nameof(action));
            }

            var data = new TFBuildPublishCodeCoverageData();

            action(data);

            PublishCodeCoverage(summaryFilePath, data);
        }
Exemple #3
0
            public void Should_Publish_Code_Coverage_If_File_Path_Provided()
            {
                const string expected = @"##vso[codecoverage.publish codecoveragetool=Cobertura;summaryfile=C:\build\CAKE-CAKE-JOB1\coverage\cobertura-coverage.xml;reportdirectory=C:\build\CAKE-CAKE-JOB1\coverage\report;]";

                // Given
                var fixture = new TFBuildFixture();
                var service = fixture.CreateTFBuildService();
                var data    = new TFBuildPublishCodeCoverageData
                {
                    CodeCoverageTool = TFCodeCoverageToolType.Cobertura,
                    ReportDirectory  = "./coverage/report"
                };

                // When
                service.Commands.PublishCodeCoverage("./coverage/cobertura-coverage.xml", data);

                // Then
                Assert.Equal(expected.Replace('\\', System.IO.Path.DirectorySeparatorChar), fixture.Writer.Entries.FirstOrDefault());
            }
Exemple #4
0
            public void Should_Publish_Code_Coverage()
            {
                const string expected = @"##vso[codecoverage.publish codecoveragetool=Cobertura;summaryfile=/build/CAKE-CAKE-JOB1/coverage/cobertura-coverage.xml;reportdirectory=/build/CAKE-CAKE-JOB1/coverage/report;]";

                // Given
                var fixture = new TFBuildFixture();
                var service = fixture.CreateTFBuildService(PlatformFamily.OSX, "/build/CAKE-CAKE-JOB1");
                var data    = new TFBuildPublishCodeCoverageData
                {
                    CodeCoverageTool    = TFCodeCoverageToolType.Cobertura,
                    SummaryFileLocation = "./coverage/cobertura-coverage.xml",
                    ReportDirectory     = "./coverage/report"
                };

                // When
                service.Commands.PublishCodeCoverage(data);

                // Then
                Assert.Equal(expected.Replace('/', System.IO.Path.DirectorySeparatorChar), fixture.Writer.Entries.FirstOrDefault());
            }
Exemple #5
0
            public void Should_Publish_Code_Coverage()
            {
                // Given
                var fixture = new TFBuildFixture();
                var service = fixture.CreateTFBuildService();
                var data    = new TFBuildPublishCodeCoverageData
                {
                    CodeCoverageTool    = TFCodeCoverageToolType.Cobertura,
                    SummaryFileLocation = FilePath.FromString("./coverage/cobertura-coverage.xml").ToString(),
                    ReportDirectory     = DirectoryPath.FromString("./coverage/report").ToString()
                };

                // When
                service.Commands.PublishCodeCoverage(data);

                // Then
                const string expected = @"##vso[codecoverage.publish codecoveragetool=Cobertura;summaryfile=C:\build\CAKE-CAKE-JOB1\coverage\cobertura-coverage.xml;reportdirectory=C:\build\CAKE-CAKE-JOB1\coverage\report;]";
                var          actual   = fixture.Log.Entries.FirstOrDefault();

                Assert.Equal(expected, actual?.Message);
            }
Exemple #6
0
        /// <summary>
        /// Publishes and uploads code coverage results
        /// </summary>
        /// <param name="data">The code coverage data</param>
        public void PublishCodeCoverage(TFBuildPublishCodeCoverageData data)
        {
            var properties = data.GetProperties(_environment);

            WriteLoggingCommand("codecoverage.publish", properties, string.Empty);
        }