/// <summary> /// Used for unit testing only. /// </summary> /// <param name="testCases"></param> /// <param name="package">The user input test source(package) if it differ from actual test source otherwise null.</param> /// <param name="testRunCache"></param> /// <param name="runSettings"></param> /// <param name="testExecutionContext"></param> /// <param name="testCaseEventsHandler"></param> /// <param name="testRunEventsHandler"></param> /// <param name="executorUriVsTestList"></param> internal RunTestsWithTests(IRequestData requestData, IEnumerable <TestCase> testCases, string package, string runSettings, TestExecutionContext testExecutionContext, ITestCaseEventsHandler testCaseEventsHandler, ITestRunEventsHandler testRunEventsHandler, Dictionary <Tuple <Uri, string>, List <TestCase> > executorUriVsTestList) : base(requestData, package, runSettings, testExecutionContext, testCaseEventsHandler, testRunEventsHandler, TestPlatformEventSource.Instance) { this.testCases = testCases; this.executorUriVsTestList = executorUriVsTestList; this.testCaseEventsHandler = testCaseEventsHandler; }
/// <summary> /// Starts the test run with tests. /// </summary> /// <param name="tests"> The test list. </param> /// <param name="runSettings"> The run Settings. </param> /// <param name="testExecutionContext"> The test Execution Context. </param> /// <param name="testCaseEventsHandler"> EventHandler for handling test cases level events from Engine. </param> /// <param name="runEventsHandler"> EventHandler for handling execution events from Engine. </param> public void StartTestRun( IEnumerable <TestCase> tests, string runSettings, TestExecutionContext testExecutionContext, ITestCaseEventsHandler testCaseEventsHandler, ITestRunEventsHandler runEventsHandler) { this.testRunEventsHandler = runEventsHandler; try { this.activeTestRun = new RunTestsWithTests( tests, runSettings, testExecutionContext, testCaseEventsHandler, runEventsHandler); this.activeTestRun.RunTests(); } catch (Exception e) { this.testRunEventsHandler.HandleLogMessage(ObjectModel.Logging.TestMessageLevel.Error, e.ToString()); this.Abort(); } finally { this.activeTestRun = null; } }
public TestableBaseRunTests( IRequestData requestData, string package, string runSettings, TestExecutionContext testExecutionContext, ITestCaseEventsHandler testCaseEventsHandler, ITestRunEventsHandler testRunEventsHandler, ITestPlatformEventSource testPlatformEventSource, ITestEventsPublisher testEventsPublisher, IThread platformThread, IDataSerializer dataSerializer) : base( requestData, package, runSettings, testExecutionContext, testCaseEventsHandler, testRunEventsHandler, testPlatformEventSource, testEventsPublisher, platformThread, dataSerializer) { this.testCaseEventsHandler = testCaseEventsHandler; }
/// <summary> /// Starts the test run /// </summary> /// <param name="adapterSourceMap"> The adapter Source Map. </param> /// <param name="package">The user input test source(package) if it differ from actual test source otherwise null.</param> /// <param name="runSettings"> The run Settings. </param> /// <param name="testExecutionContext"> The test Execution Context. </param> /// <param name="testCaseEventsHandler"> EventHandler for handling test cases level events from Engine. </param> /// <param name="runEventsHandler"> EventHandler for handling execution events from Engine. </param> public void StartTestRun( Dictionary <string, IEnumerable <string> > adapterSourceMap, string package, string runSettings, TestExecutionContext testExecutionContext, ITestCaseEventsHandler testCaseEventsHandler, ITestRunEventsHandler runEventsHandler) { try { this.InitializeDataCollectors(runSettings, testCaseEventsHandler as ITestEventsPublisher, TestSourcesUtility.GetDefaultCodebasePath(adapterSourceMap)); this.activeTestRun = new RunTestsWithSources(this.requestData, adapterSourceMap, package, runSettings, testExecutionContext, testCaseEventsHandler, runEventsHandler); this.activeTestRun.RunTests(); } catch (Exception e) { runEventsHandler.HandleLogMessage(TestMessageLevel.Error, e.ToString()); this.Abort(runEventsHandler); } finally { this.activeTestRun = null; } }
/// <summary> /// Initializes a new instance of the <see cref="BaseRunTests"/> class. /// </summary> /// <param name="requestData">Provides services and data for execution</param> /// <param name="package">The user input test source(package) list if it differs from actual test source otherwise null.</param> /// <param name="runSettings">The run settings.</param> /// <param name="testExecutionContext">The test execution context.</param> /// <param name="testCaseEventsHandler">The test case events handler.</param> /// <param name="testRunEventsHandler">The test run events handler.</param> /// <param name="testPlatformEventSource">Test platform event source.</param> /// <param name="testEventsPublisher">Publisher for test events.</param> /// <param name="platformThread">Platform Thread.</param> /// <param name="dataSerializer">Data Serializer for cloning TestCase and test results object.</param> protected BaseRunTests( IRequestData requestData, string package, string runSettings, TestExecutionContext testExecutionContext, ITestCaseEventsHandler testCaseEventsHandler, ITestRunEventsHandler testRunEventsHandler, ITestPlatformEventSource testPlatformEventSource, ITestEventsPublisher testEventsPublisher, IThread platformThread, IDataSerializer dataSerializer) { this.package = package; this.runSettings = runSettings; this.testExecutionContext = testExecutionContext; this.testCaseEventsHandler = testCaseEventsHandler; this.testRunEventsHandler = testRunEventsHandler; this.requestData = requestData; this.isCancellationRequested = false; this.testPlatformEventSource = testPlatformEventSource; this.testEventsPublisher = testEventsPublisher; this.platformThread = platformThread; this.dataSerializer = dataSerializer; this.SetContext(); }
/// <summary> /// Used for unit testing only. /// </summary> /// <param name="requestData"></param> /// <param name="adapterSourceMap"></param> /// <param name="package">The user input test source(package) if it differ from actual test source otherwise null.</param> /// <param name="runSettings"></param> /// <param name="testExecutionContext"></param> /// <param name="testCaseEventsHandler"></param> /// <param name="testRunEventsHandler"></param> /// <param name="executorUriVsSourceList"></param> /// <param name="testRunCache"></param> internal RunTestsWithSources(IRequestData requestData, Dictionary <string, IEnumerable <string> > adapterSourceMap, string package, string runSettings, TestExecutionContext testExecutionContext, ITestCaseEventsHandler testCaseEventsHandler, ITestRunEventsHandler testRunEventsHandler, Dictionary <Tuple <Uri, string>, IEnumerable <string> > executorUriVsSourceList) : base(requestData, package, runSettings, testExecutionContext, testCaseEventsHandler, testRunEventsHandler, TestPlatformEventSource.Instance) { this.adapterSourceMap = adapterSourceMap; this.executorUriVsSourceList = executorUriVsSourceList; this.testCaseEventsHandler = testCaseEventsHandler; }
/// <summary> /// Starts the test run with tests. /// </summary> /// <param name="tests"> The test list. </param> /// <param name="runSettings"> The run Settings. </param> /// <param name="testExecutionContext"> The test Execution Context. </param> /// <param name="testCaseEventsHandler"> EventHandler for handling test cases level events from Engine. </param> /// <param name="runEventsHandler"> EventHandler for handling execution events from Engine. </param> public void StartTestRun( IEnumerable <TestCase> tests, string runSettings, TestExecutionContext testExecutionContext, ITestCaseEventsHandler testCaseEventsHandler, ITestRunEventsHandler runEventsHandler) { this.testRunEventsHandler = runEventsHandler; try { this.activeTestRun = new RunTestsWithTests( tests, runSettings, testExecutionContext, testCaseEventsHandler, runEventsHandler); this.activeTestRun.RunTests(); } finally { this.activeTestRun = null; } }
/// <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> /// Starts the test run /// </summary> /// <param name="adapterSourceMap"> The adapter Source Map. </param> /// <param name="package">The user input test source(package) if it differ from actual test source otherwise null.</param> /// <param name="runSettings"> The run Settings. </param> /// <param name="testExecutionContext"> The test Execution Context. </param> /// <param name="testCaseEventsHandler"> EventHandler for handling test cases level events from Engine. </param> /// <param name="runEventsHandler"> EventHandler for handling execution events from Engine. </param> public void StartTestRun( Dictionary <string, IEnumerable <string> > adapterSourceMap, string package, string runSettings, TestExecutionContext testExecutionContext, ITestCaseEventsHandler testCaseEventsHandler, ITestRunEventsHandler runEventsHandler) { this.testRunEventsHandler = runEventsHandler; try { this.activeTestRun = new RunTestsWithSources(this.requestData, adapterSourceMap, package, runSettings, testExecutionContext, testCaseEventsHandler, runEventsHandler); this.activeTestRun.RunTests(); } catch (Exception e) { this.testRunEventsHandler.HandleLogMessage(ObjectModel.Logging.TestMessageLevel.Error, e.ToString()); this.Abort(); } finally { this.activeTestRun = null; } }
public TestableRunTestsWithTests(IEnumerable <TestCase> testCases, string runSettings, TestExecutionContext testExecutionContext, ITestCaseEventsHandler testCaseEventsHandler, ITestRunEventsHandler testRunEventsHandler, IRequestData requestData) : base(requestData, testCases, null, runSettings, testExecutionContext, testCaseEventsHandler, testRunEventsHandler) { }
internal TestableRunTestsWithSources(Dictionary <string, IEnumerable <string> > adapterSourceMap, string runSettings, TestExecutionContext testExecutionContext, ITestCaseEventsHandler testCaseEventsHandler, ITestRunEventsHandler testRunEventsHandler, Dictionary <Tuple <Uri, string>, IEnumerable <string> > executorUriVsSourceList) : base( adapterSourceMap, runSettings, testExecutionContext, testCaseEventsHandler, testRunEventsHandler, executorUriVsSourceList) { }
public TestableBaseRunTests( string runSettings, TestExecutionContext testExecutionContext, ITestCaseEventsHandler testCaseEventsHandler, ITestRunEventsHandler testRunEventsHandler, ITestPlatformEventSource testPlatformEventSource) : base(runSettings, testExecutionContext, testCaseEventsHandler, testRunEventsHandler, testPlatformEventSource) { }
/// <summary> /// Initializes a new instance of the <see cref="BaseRunTests"/> class. /// </summary> /// <param name="runSettings"> The run settings. </param> /// <param name="testExecutionContext"> The test execution context. </param> /// <param name="testCaseEventsHandler"> The test case events handler. </param> /// <param name="testRunEventsHandler"> The test run events handler. </param> /// <param name="testPlatformEventSource"></param> protected BaseRunTests(string runSettings, TestExecutionContext testExecutionContext, ITestCaseEventsHandler testCaseEventsHandler, ITestRunEventsHandler testRunEventsHandler, ITestPlatformEventSource testPlatformEventSource) { this.runSettings = runSettings; this.testExecutionContext = testExecutionContext; this.testCaseEventsHandler = testCaseEventsHandler; this.testRunEventsHandler = testRunEventsHandler; this.isCancellationRequested = false; this.testPlatformEventSource = testPlatformEventSource; this.SetContext(); }
public TestableBaseRunTests( string runSettings, string package, TestExecutionContext testExecutionContext, ITestCaseEventsHandler testCaseEventsHandler, ITestRunEventsHandler testRunEventsHandler, ITestPlatformEventSource testPlatformEventSource, IRequestData requestData) : base(requestData, package, runSettings, testExecutionContext, testCaseEventsHandler, testRunEventsHandler, testPlatformEventSource) { }
private ITestCaseEventsHandler GetTestCaseEventsHandler(string runSettings) { ITestCaseEventsHandler testCaseEventsHandler = null; // Listen to test case events only if data collection is enabled if ((XmlRunSettingsUtilities.IsDataCollectionEnabled(runSettings) && DataCollectionTestCaseEventSender.Instance != null) || XmlRunSettingsUtilities.IsInProcDataCollectionEnabled(runSettings)) { testCaseEventsHandler = new TestCaseEventsHandler(); } return(testCaseEventsHandler); }
public TestableBaseRunTests( string runSettings, TestExecutionContext testExecutionContext, ITestCaseEventsHandler testCaseEventsHandler, ITestRunEventsHandler testRunEventsHandler, ITestPlatformEventSource testPlatformEventSource, ITestEventsPublisher testEventsPublisher, IThread platformThread, IRequestData requestData) : base(requestData, null, runSettings, testExecutionContext, testCaseEventsHandler, testRunEventsHandler, testPlatformEventSource, testEventsPublisher, platformThread) { }
private ITestCaseEventsHandler GetTestCaseEventsHandler(string runSettings) { ITestCaseEventsHandler testCaseEventsHandler = null; if ((XmlRunSettingsUtilities.IsDataCollectionEnabled(runSettings) && DataCollectionTestCaseEventSender.Instance != null) || XmlRunSettingsUtilities.IsInProcDataCollectionEnabled(runSettings)) { testCaseEventsHandler = new TestCaseEventsHandler(); var testEventsPublisher = testCaseEventsHandler as ITestEventsPublisher; } return(testCaseEventsHandler); }
/// <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>(); }
/// <summary> /// Initializes a new instance of the <see cref="BaseRunTests"/> class. /// </summary> /// <param name="runSettings">The run settings.</param> /// <param name="testExecutionContext">The test execution context.</param> /// <param name="testCaseEventsHandler">The test case events handler.</param> /// <param name="testRunEventsHandler">The test run events handler.</param> /// <param name="testPlatformEventSource">Test platform event source.</param> protected BaseRunTests(string runSettings, TestExecutionContext testExecutionContext, ITestCaseEventsHandler testCaseEventsHandler, ITestRunEventsHandler testRunEventsHandler, ITestPlatformEventSource testPlatformEventSource) : this( runSettings, testExecutionContext, testCaseEventsHandler, testRunEventsHandler, testPlatformEventSource, testCaseEventsHandler as ITestEventsPublisher, new PlatformThread()) { }
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>(); }
/// <summary> /// Initializes a new instance of the <see cref="BaseRunTests"/> class. /// </summary> /// <param name="requestData">The request data for providing common execution services and data</param> /// <param name="package">The user input test source(package) if it differs from actual test source otherwise null.</param> /// <param name="runSettings">The run settings.</param> /// <param name="testExecutionContext">The test execution context.</param> /// <param name="testCaseEventsHandler">The test case events handler.</param> /// <param name="testRunEventsHandler">The test run events handler.</param> /// <param name="testPlatformEventSource">Test platform event source.</param> protected BaseRunTests( IRequestData requestData, string package, string runSettings, TestExecutionContext testExecutionContext, ITestCaseEventsHandler testCaseEventsHandler, ITestRunEventsHandler testRunEventsHandler, ITestPlatformEventSource testPlatformEventSource) : this( requestData, package, runSettings, testExecutionContext, testCaseEventsHandler, testRunEventsHandler, testPlatformEventSource, testCaseEventsHandler as ITestEventsPublisher, new PlatformThread(), JsonDataSerializer.Instance) { }
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> /// Starts the test run /// </summary> /// <param name="adapterSourceMap"> The adapter Source Map. </param> /// <param name="runSettings"> The run Settings. </param> /// <param name="testExecutionContext"> The test Execution Context. </param> /// <param name="testCaseEventsHandler"> EventHandler for handling test cases level events from Engine. </param> /// <param name="runEventsHandler"> EventHandler for handling execution events from Engine. </param> public void StartTestRun( Dictionary <string, IEnumerable <string> > adapterSourceMap, string runSettings, TestExecutionContext testExecutionContext, ITestCaseEventsHandler testCaseEventsHandler, ITestRunEventsHandler runEventsHandler) { this.testRunEventsHandler = runEventsHandler; try { this.activeTestRun = new RunTestsWithSources( adapterSourceMap, runSettings, testExecutionContext, testCaseEventsHandler, runEventsHandler); this.activeTestRun.RunTests(); } finally { this.activeTestRun = null; } }
public RunTestsWithTests(IRequestData requestData, IEnumerable <TestCase> testCases, string package, string runSettings, TestExecutionContext testExecutionContext, ITestCaseEventsHandler testCaseEventsHandler, ITestRunEventsHandler testRunEventsHandler) : this(requestData, testCases, package, runSettings, testExecutionContext, testCaseEventsHandler, testRunEventsHandler, null) { }
public RunTestsWithSources(Dictionary <string, IEnumerable <string> > adapterSourceMap, string runSettings, TestExecutionContext testExecutionContext, ITestCaseEventsHandler testCaseEventsHandler, ITestRunEventsHandler testRunEventsHandler) : this(adapterSourceMap, runSettings, testExecutionContext, testCaseEventsHandler, testRunEventsHandler, null) { }
/// <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>(); }
public RunTestsWithTests(IEnumerable <TestCase> testCases, string runSettings, TestExecutionContext testExecutionContext, ITestCaseEventsHandler testCaseEventsHandler, ITestRunEventsHandler testRunEventsHandler) : this(testCases, runSettings, testExecutionContext, testCaseEventsHandler, testRunEventsHandler, null) { }
public TestableRunTestsWithSources(Dictionary <string, IEnumerable <string> > adapterSourceMap, string runSettings, TestExecutionContext testExecutionContext, ITestCaseEventsHandler testCaseEventsHandler, ITestRunEventsHandler testRunEventsHandler, IRequestData requestData) : base(requestData, adapterSourceMap, null, runSettings, testExecutionContext, testCaseEventsHandler, testRunEventsHandler) { }
public RunTestsWithSources(IRequestData requestData, Dictionary <string, IEnumerable <string> > adapterSourceMap, string package, string runSettings, TestExecutionContext testExecutionContext, ITestCaseEventsHandler testCaseEventsHandler, ITestRunEventsHandler testRunEventsHandler) : this(requestData, adapterSourceMap, package, runSettings, testExecutionContext, testCaseEventsHandler, testRunEventsHandler, null) { }
internal TestableRunTestsWithTests(IEnumerable <TestCase> testCases, string runSettings, TestExecutionContext testExecutionContext, ITestCaseEventsHandler testCaseEventsHandler, ITestRunEventsHandler testRunEventsHandler, Dictionary <Tuple <Uri, string>, List <TestCase> > executorUriVsTestList, IRequestData requestData) : base( requestData, testCases, null, runSettings, testExecutionContext, testCaseEventsHandler, testRunEventsHandler, executorUriVsTestList) { }