示例#1
0
        public async Task Save(JsonReport report, string version)
        {
            var fileUrl = $"{_options.AzureFileStorageUrl}/{_outputPath}/{version}/stryker-report.json";
            var url     = new Uri($"{fileUrl}?comp=range&sv={_options.AzureSAS}");

            var existingReport = await Load(version);

            var reportJson = report.ToJson();

            int byteSize = Encoding.UTF8.GetByteCount(report.ToJson());

            if (existingReport == null)
            {
                var succesfullyCreatedDirectories = await CreateDirectories(fileUrl);

                if (!succesfullyCreatedDirectories)
                {
                    return;
                }
            }

            // If the file already exists, this replaces the existing file. Does not add content to the file
            var successfullyAllocated = await AllocateFileLocation(byteSize, fileUrl);

            if (!successfullyAllocated)
            {
                return;
            }

            // This adds the content to the file
            await UploadFile(reportJson, byteSize, url);

            _logger.LogDebug("Baseline report has been saved to {0}", fileUrl);
        }
        public async Task Save(JsonReport report, string version)
        {
            var reportPath = FilePathUtils.NormalizePathSeparators(
                Path.Combine(_options.BasePath, _outputPath, version));

            var reportJson = report.ToJson();

            _fileSystem.Directory.CreateDirectory(reportPath);

            using StreamWriter outputWriter = _fileSystem.File.CreateText(Path.Combine(reportPath, $"stryker-report.json"));

            await outputWriter.WriteAsync(reportJson);

            _logger.LogDebug($"Baseline report has been saved to {Path.Combine(reportPath, $"stryker-report.json")}");
        }
示例#3
0
        private async Task UploadHumanReadableReport(JsonReport mutationReport)
        {
            var reportUrl = await _dashboardClient.PublishReport(mutationReport.ToJson(), _options.ProjectVersion);

            if (reportUrl != null)
            {
                _logger.LogDebug("Your stryker report has been uploaded to: \n {0} \nYou can open it in your browser of choice.", reportUrl);
                _chalk.Green($"Your stryker report has been uploaded to: \n {reportUrl} \nYou can open it in your browser of choice.");
            }
            else
            {
                _logger.LogError("Uploading to stryker dashboard failed...");
            }

            Console.WriteLine(Environment.NewLine);
        }
示例#4
0
        private async Task UploadBaseline(JsonReport mutationReport)
        {
            var branchName = _gitInfoProvider.GetCurrentBranchName();

            var baselineLocation = $"dashboard-compare/{branchName}";


            var reportUrl = await _dashboardClient.PublishReport(mutationReport.ToJson(), baselineLocation);

            if (reportUrl != null)
            {
                _logger.LogDebug($"\nYour baseline stryker report has been uploaded to: \n {reportUrl} \nYou can open it in your browser of choice.");
            }
            else
            {
                _logger.LogError("Uploading to stryker dashboard failed...");
            }
        }
示例#5
0
 public async Task Save(JsonReport report, string version)
 {
     await _client.PublishReport(report.ToJson(), version);
 }