/// <summary> /// Initializes out-proc and in-proc data collectors. /// </summary> private void InitializeDataCollectors(string runSettings, ITestEventsPublisher testEventsPublisher, string defaultCodeBase) { // Initialize out-proc data collectors if declared in run settings. if (DataCollectionTestCaseEventSender.Instance != null && XmlRunSettingsUtilities.IsDataCollectionEnabled(runSettings)) { var outOfProcDataCollectionManager = new ProxyOutOfProcDataCollectionManager(DataCollectionTestCaseEventSender.Instance, testEventsPublisher); } // Initialize in-proc data collectors if declared in run settings. if (XmlRunSettingsUtilities.IsInProcDataCollectionEnabled(runSettings)) { var inProcDataCollectionExtensionManager = new InProcDataCollectionExtensionManager(runSettings, testEventsPublisher, defaultCodeBase, TestPluginCache.Instance); } }
public void InProcDataCollectionExtensionManagerWillNotEnableDataCollectionForInavlidSettingsXml() { var invalidSettingsXml = @"<RunSettings> <InProcDataCollectionRunSettings> <InProcDataCollectors> <InProcDataCollector friendlyName='Test Impact' uri='InProcDataCollector://Microsoft/TestImpact/1.0' assemblyQualifiedName='TestImpactListener.Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7ccb7239ffde675a' codebase='E:\repos\MSTest\src\managed\TestPlatform\TestImpactListener.Tests\bin\Debug\TestImpactListener.Tests.dll' value='Invalid'> <Configuration> <Port>4312</Port> </Configuration> </InProcDataCollector> </InProcDataCollectors> </InProcDataCollectionRunSettings> </RunSettings>"; var manager = new InProcDataCollectionExtensionManager(invalidSettingsXml, this.mockTestEventsPublisher.Object, this.defaultCodebase, this.testPluginCache); Assert.IsFalse(manager.IsInProcDataCollectionEnabled, "InProcDataCollection must be disabled on invalid settings."); }
private void SetContext() { this.testRunCache = new TestRunCache(this.testExecutionContext.FrequencyOfRunStatsChangeEvent, testExecutionContext.RunStatsChangeEventTimeout, this.OnCacheHit); this.dataCollectionTestCaseEventManager = new DataCollectionTestCaseEventManager(testRunCache); this.inProcDataCollectionExtensionManager = new InProcDataCollectionExtensionManager(runSettings, testRunCache, this.dataCollectionTestCaseEventManager); if (DataCollectionTestCaseEventSender.Instance != null) { this.outOfProcDataCollectionManager = new ProxyOutOfProcDataCollectionManager(DataCollectionTestCaseEventSender.Instance, this.dataCollectionTestCaseEventManager); } if (!inProcDataCollectionExtensionManager.IsInProcDataCollectionEnabled) { // No need to call any methods on this, if inproc-datacollection is not enabled inProcDataCollectionExtensionManager = null; } if (inProcDataCollectionExtensionManager != null || DataCollectionTestCaseEventSender.Instance != null) { this.testCaseEventsHandler = new TestCaseEventsHandler(this.dataCollectionTestCaseEventManager, this.testCaseEventsHandler); } this.runContext = new RunContext(); this.runContext.RunSettings = RunSettingsUtilities.CreateAndInitializeRunSettings(this.runSettings); this.runContext.KeepAlive = this.testExecutionContext.KeepAlive; this.runContext.InIsolation = this.testExecutionContext.InIsolation; this.runContext.IsDataCollectionEnabled = this.testExecutionContext.IsDataCollectionEnabled; this.runContext.IsBeingDebugged = this.testExecutionContext.IsDebug; var runConfig = XmlRunSettingsUtilities.GetRunConfigurationNode(this.runSettings); this.runContext.TestRunDirectory = RunSettingsUtilities.GetTestResultsDirectory(runConfig); this.runContext.SolutionDirectory = RunSettingsUtilities.GetSolutionDirectory(runConfig); this.frameworkHandle = new FrameworkHandle( this.testCaseEventsHandler, this.testRunCache, this.testExecutionContext, this.testRunEventsHandler); this.frameworkHandle.TestRunMessage += this.OnTestRunMessage; this.executorUrisThatRanTests = new List <string>(); }
private void SetContext() { this.testRunCache = new TestRunCache(this.testExecutionContext.FrequencyOfRunStatsChangeEvent, this.testExecutionContext.RunStatsChangeEventTimeout, this.OnCacheHit); // Initialize data collectors if declared in run settings. if (DataCollectionTestCaseEventSender.Instance != null && XmlRunSettingsUtilities.IsDataCollectionEnabled(this.runSettings)) { var outOfProcDataCollectionManager = new ProxyOutOfProcDataCollectionManager(DataCollectionTestCaseEventSender.Instance, this.testEventsPublisher); } if (XmlRunSettingsUtilities.IsInProcDataCollectionEnabled(this.runSettings)) { var inProcDataCollectionExtensionManager = new InProcDataCollectionExtensionManager(this.runSettings, this.testEventsPublisher); } this.runContext = new RunContext(); this.runContext.RunSettings = RunSettingsUtilities.CreateAndInitializeRunSettings(this.runSettings); this.runContext.KeepAlive = this.testExecutionContext.KeepAlive; this.runContext.InIsolation = this.testExecutionContext.InIsolation; this.runContext.IsDataCollectionEnabled = this.testExecutionContext.IsDataCollectionEnabled; this.runContext.IsBeingDebugged = this.testExecutionContext.IsDebug; var runConfig = XmlRunSettingsUtilities.GetRunConfigurationNode(this.runSettings); this.runContext.TestRunDirectory = RunSettingsUtilities.GetTestResultsDirectory(runConfig); this.runContext.SolutionDirectory = RunSettingsUtilities.GetSolutionDirectory(runConfig); this.runConfiguration = runConfig; this.frameworkHandle = new FrameworkHandle( this.testCaseEventsHandler, this.testRunCache, this.testExecutionContext, this.testRunEventsHandler); this.frameworkHandle.TestRunMessage += this.OnTestRunMessage; this.executorUrisThatRanTests = new List <string>(); }
private void SetContext() { this.testRunCache = new TestRunCache(testExecutionContext.FrequencyOfRunStatsChangeEvent, testExecutionContext.RunStatsChangeEventTimeout, this.OnCacheHit); this.inProcDataCollectionExtensionManager = new InProcDataCollectionExtensionManager(runSettings, testRunCache); // Verify if datacollection is enabled and wrap the testcasehandler around to get the events if (inProcDataCollectionExtensionManager.IsInProcDataCollectionEnabled) { this.testCaseEventsHandler = new TestCaseEventsHandler(inProcDataCollectionExtensionManager, this.testCaseEventsHandler); } else { // No need to call any methods on this, if inproc-datacollection is not enabled inProcDataCollectionExtensionManager = null; } this.runContext = new RunContext(); this.runContext.RunSettings = RunSettingsUtilities.CreateAndInitializeRunSettings(this.runSettings); this.runContext.KeepAlive = this.testExecutionContext.KeepAlive; this.runContext.InIsolation = this.testExecutionContext.InIsolation; this.runContext.IsDataCollectionEnabled = this.testExecutionContext.IsDataCollectionEnabled; this.runContext.IsBeingDebugged = this.testExecutionContext.IsDebug; var runConfig = XmlRunSettingsUtilities.GetRunConfigurationNode(this.runSettings); this.runContext.TestRunDirectory = RunSettingsUtilities.GetTestResultsDirectory(runConfig); this.runContext.SolutionDirectory = RunSettingsUtilities.GetSolutionDirectory(runConfig); this.frameworkHandle = new FrameworkHandle( this.testCaseEventsHandler, this.testRunCache, this.testExecutionContext, this.testRunEventsHandler); this.executorUrisThatRanTests = new List <string>(); }
/// <summary> /// Initializes a new instance of the <see cref="TestCaseEventsHandler"/> class. /// </summary> /// <param name="inProcDCExtMgr"> /// The in proc tidc helper. /// </param> public TestCaseEventsHandler(InProcDataCollectionExtensionManager inProcDataCollectionExtensionManager, ITestCaseEventsHandler testCaseEvents) { this.inProcDataCollectionExtensionManager = inProcDataCollectionExtensionManager; this.testCaseEvents = testCaseEvents; }