public void InitializePublisher(IExecutionContext executionContext, VssConnection connection, string projectName, IResultReader resultReader) { Trace.Entering(); _executionContext = executionContext; _projectName = projectName; _resultReader = resultReader; connection.InnerHandler.Settings.SendTimeout = TimeSpan.FromSeconds(PUBLISH_TIMEOUT); _testResultsServer = HostContext.GetService<ITestResultsServer>(); _testResultsServer.InitializeServer(connection); Trace.Leaving(); }
public void InitializePublisher(IExecutionContext executionContext, VssConnection connection, string projectName, IResultReader resultReader) { Trace.Entering(); _executionContext = executionContext; _projectName = projectName; _resultReader = resultReader; connection.InnerHandler.Settings.SendTimeout = TimeSpan.FromSeconds(PUBLISH_TIMEOUT); _testResultsServer = HostContext.GetService <ITestResultsServer>(); _testResultsServer.InitializeServer(connection); Trace.Leaving(); }
public void InitializePublisher(IExecutionContext context, string projectName, VssConnection connection, string testRunner, bool publishRunLevelAttachments) { Trace.Entering(); _executionContext = context; _projectName = projectName; _testRunner = testRunner; _resultReader = GetTestResultReader(_testRunner, publishRunLevelAttachments); _testRunPublisher = HostContext.GetService <ITestRunPublisher>(); _featureFlagService = HostContext.GetService <IFeatureFlagService>(); _testRunPublisher.InitializePublisher(_executionContext, connection, projectName, _resultReader); _testResultsServer = HostContext.GetService <ITestResultsServer>(); _testResultsServer.InitializeServer(connection, _executionContext); _calculateTestRunSummary = _featureFlagService.GetFeatureFlagState(TestResultsConstants.CalculateTestRunSummaryFeatureFlag, TestResultsConstants.TFSServiceInstanceGuid); _testRunPublisherHelper = new TestRunDataPublisherHelper(_executionContext, null, _testRunPublisher, _testResultsServer); Trace.Leaving(); }
private void TriggerCoverageMergeJob(List <string> resultFilesInput, IExecutionContext context) { try { ITestResultsServer _testResultsServer = context.GetHostContext().GetService <ITestResultsServer>(); foreach (var resultFile in resultFilesInput) { string text = File.ReadAllText(resultFile); XmlDocument xdoc = new XmlDocument(); xdoc.LoadXml(text); XmlNodeList nodes = xdoc.GetElementsByTagName("A"); var connection = WorkerUtilities.GetVssConnection(_executionContext); foreach (XmlNode attachmentNode in nodes) { var file = attachmentNode.Attributes?["href"]?.Value; if (!string.IsNullOrEmpty(file)) { if ( Path.GetExtension(file).Equals(".covx", StringComparison.OrdinalIgnoreCase) || Path.GetExtension(file).Equals(".covb", StringComparison.OrdinalIgnoreCase) || Path.GetExtension(file).Equals(".coverage", StringComparison.OrdinalIgnoreCase) ) { _testResultsServer.InitializeServer(connection, _executionContext); try { var codeCoverageResults = _testResultsServer.UpdateCodeCoverageSummaryAsync(connection, _executionContext.Variables.System_TeamProjectId.ToString(), _executionContext.Variables.Build_BuildId.GetValueOrDefault()); } catch (Exception e) { _executionContext.Section($"Could not queue code coverage merge:{e}"); } } } } } } catch (Exception e) { _executionContext.Debug($"Exception in Method:{e.Message}"); } }