Ejemplo n.º 1
0
        private void SetContext()
        {
            this.testRunCache = new TestRunCache(this.testExecutionContext.FrequencyOfRunStatsChangeEvent, this.testExecutionContext.RunStatsChangeEventTimeout, this.OnCacheHit);

            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>();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FrameworkHandle"/> class.
 /// </summary>
 /// <param name="testCaseEventsHandler"> The test case level events handler. </param>
 /// <param name="testRunCache"> The test run cache. </param>
 /// <param name="testExecutionContext"> The test execution context. </param>
 /// <param name="testRunEventsHandler">TestRun Events Handler</param>
 public FrameworkHandle(ITestCaseEventsHandler testCaseEventsHandler, ITestRunCache testRunCache,
                        TestExecutionContext testExecutionContext, ITestRunEventsHandler testRunEventsHandler)
     : base(testCaseEventsHandler, testRunCache)
 {
     this.testExecutionContext = testExecutionContext;
     this.testRunEventsHandler = testRunEventsHandler;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="DataCollectionTestCaseEventManager"/> class.
        /// </summary>
        /// <param name="testRunCache">
        /// The test run cache.
        /// </param>
        public DataCollectionTestCaseEventManager(ITestRunCache testRunCache)
        {
            this.testRunCache         = testRunCache;
            this.testResultDictionary = new Dictionary <Guid, List <TestResult> >();
            this.testCaseEndStatusMap = new HashSet <Guid>();

            FlushResultTestResultPoperty = TestProperty.Register(id: "allowTestResultFlush", label: "allowTestResultFlush", category: string.Empty, description: string.Empty, valueType: typeof(bool), validateValueCallback: null, attributes: TestPropertyAttributes.None, owner: typeof(TestCase));
        }
        public InProcDataCollectionExtensionManager(string runSettings, ITestRunCache testRunCache)
        {
            this.testRunCache = testRunCache;

            this.inProcDataCollectors     = new Dictionary <string, IInProcDataCollector>();
            this.inProcDataCollectionSink = new InProcDataCollectionSink();
            this.testResultDictionary     = new Dictionary <Guid, List <TestResult> >();
            this.testCaseEndStatusMap     = new HashSet <Guid>();

            // Initialize InProcDataCollectors
            this.InitializeInProcDataCollectors(runSettings);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TestExecutionRecorder"/> class.
        /// </summary>
        /// <param name="testCaseEventsHandler"> The test Case Events Handler. </param>
        /// <param name="testRunCache"> The test run cache.  </param>
        public TestExecutionRecorder(ITestCaseEventsHandler testCaseEventsHandler, ITestRunCache testRunCache)
        {
            this.testRunCache          = testRunCache;
            this.testCaseEventsHandler = testCaseEventsHandler;
            this.attachmentSets        = new List <AttachmentSet>();

            // As a framework guideline, we should get events in this order:
            // 1. Test Case Start.
            // 2. Test Case End.
            // 3. Test Case Result.
            // If that is not that case.
            // If Test Adapters don't send the events in the above order, Test Case Results are cached till the Test Case End event is received.
            this.testCaseEndStatusMap = new HashSet <Guid>();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="InProcDataCollectionExtensionManager"/> class.
        /// </summary>
        /// <param name="runSettings">
        /// The run settings.
        /// </param>
        /// <param name="testRunCache">
        /// The test run cache.
        /// </param>
        /// <param name="dataCollectionTestCaseEventManager">
        /// The data collection test case event manager.
        /// </param>
        public InProcDataCollectionExtensionManager(string runSettings, ITestRunCache testRunCache, IDataCollectionTestCaseEventManager dataCollectionTestCaseEventManager)
        {
            this.InProcDataCollectors     = new Dictionary <string, IInProcDataCollector>();
            this.inProcDataCollectionSink = new InProcDataCollectionSink();

            // Initialize InProcDataCollectors
            this.InitializeInProcDataCollectors(runSettings);

            if (this.IsInProcDataCollectionEnabled)
            {
                dataCollectionTestCaseEventManager.TestCaseEnd   += this.TriggerTestCaseEnd;
                dataCollectionTestCaseEventManager.TestCaseStart += this.TriggerTestCaseStart;
                dataCollectionTestCaseEventManager.TestResult    += this.TriggerUpdateTestResult;
                dataCollectionTestCaseEventManager.SessionStart  += this.TriggerTestSessionStart;
                dataCollectionTestCaseEventManager.SessionEnd    += this.TriggerTestSessionEnd;
            }
        }
Ejemplo n.º 7
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>();
        }
Ejemplo n.º 8
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>();
        }
Ejemplo n.º 9
0
        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>();
        }
Ejemplo n.º 10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TestExecutionRecorder"/> class.
 /// </summary>
 /// <param name="testCaseEventsHandler"> The test Case Events Handler. </param>
 /// <param name="testRunCache"> The test run cache.  </param>
 public TestExecutionRecorder(ITestCaseEventsHandler testCaseEventsHandler, ITestRunCache testRunCache)
 {
     this.testRunCache          = testRunCache;
     this.testCaseEventsHandler = testCaseEventsHandler;
     this.attachmentSets        = new List <AttachmentSet>();
 }
Ejemplo n.º 11
0
 public TestableInProcDataCollectionExtensionManager(string runSettings, ITestRunCache testRunCache) : base(runSettings, testRunCache)
 {
 }
 public TestableInProcDataCollectionExtensionManager(string runSettings, ITestRunCache testRunCache, IDataCollectionTestCaseEventManager dataCollectionTestCaseEventManager) : base(runSettings, testRunCache, dataCollectionTestCaseEventManager)
 {
 }