Example #1
0
        /// <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);
            }
        }
Example #2
0
        public ProxyOutOfProcDataCollectionManagerTests()
        {
            this.mockDataCollectionTestCaseEventManager = new Mock <IDataCollectionTestCaseEventManager>();
            this.mockDataCollectionTestCaseEventSender  = new Mock <IDataCollectionTestCaseEventSender>();
            this.proxyOutOfProcDataCollectionManager    = new ProxyOutOfProcDataCollectionManager(this.mockDataCollectionTestCaseEventSender.Object, this.mockDataCollectionTestCaseEventManager.Object);

            var attachmentSet = new AttachmentSet(new Uri("my://datacollector"), "mydatacollector");

            attachmentSet.Attachments.Add(new UriDataAttachment(new Uri("my://attachment.txt"), string.Empty));
            this.attachmentSets = new Collection <AttachmentSet>();
            attachmentSets.Add(attachmentSet);

            this.testcase = new TestCase();
            testcase.Id   = Guid.NewGuid();
            this.mockDataCollectionTestCaseEventSender.Setup(x => x.SendTestCaseEnd(It.IsAny <TestCaseEndEventArgs>())).Returns(attachmentSets);
            this.mockDataCollectionTestCaseEventManager.Raise(x => x.TestCaseEnd += null, new TestCaseEndEventArgs(testcase, TestOutcome.Passed));
            this.testResult = new VisualStudio.TestPlatform.ObjectModel.TestResult(testcase);
        }
Example #3
0
        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>();
        }
Example #4
0
        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>();
        }