public void GetDefaultCodeBasePathShouldReturnNullIfAdapterSourceMapIsEmpty() { var adapterSourceMap = new Dictionary <string, IEnumerable <string> >(); var defaultCodeBase = TestSourcesUtility.GetDefaultCodebasePath(adapterSourceMap); Assert.IsNull(defaultCodeBase); }
public void GetDefaultCodeBasePathShouldReturnNullIfTestCaseListIsEmpty() { var tests = new List <TestCase>(); var defaultCodeBase = TestSourcesUtility.GetDefaultCodebasePath(tests); Assert.IsNull(defaultCodeBase); }
public void GetDefaultCodeBasePathShouldReturnDefaultDirectoryPathForTestCaseList() { var tests = new List <TestCase>() { new TestCase("test1", new Uri(Path.Combine(temp, "d")), Path.Combine(temp, "folder1", "source1.dll")) }; var defaultCodeBase = TestSourcesUtility.GetDefaultCodebasePath(tests); Assert.AreEqual(Path.Combine(temp, "folder1"), defaultCodeBase); }
public void GetDefaultCodeBasePathShouldReturnDefaultDirectoryPathForTestCaseList() { var tests = new List <TestCase>() { new TestCase("test1", new Uri("e://d"), "c:\\folder1\\source1.dll") }; var defaultCodeBase = TestSourcesUtility.GetDefaultCodebasePath(tests); Assert.AreEqual("c:\\folder1", defaultCodeBase); }
public void GetDefaultCodeBasePathShouldReturnDefaultDirectoryPathForAdapterSourceMap() { var adapterSourceMap = new Dictionary <string, IEnumerable <string> >(); adapterSourceMap.Add("adapter1", new List <string>() { Path.Combine(temp, "folder1", "source1.dll"), Path.Combine(temp, "folder2", "source2.dll") }); var defaultCodeBase = TestSourcesUtility.GetDefaultCodebasePath(adapterSourceMap); Assert.AreEqual(Path.Combine(temp, "folder1"), defaultCodeBase); }
public void GetDefaultCodeBasePathShouldReturnDefaultDirectoryPathForAdapterSourceMap() { var adapterSourceMap = new Dictionary <string, IEnumerable <string> >(); adapterSourceMap.Add("adapter1", new List <string>() { "c:\\folder1\\source1.dll", "c:\\folder2\\source2.dll" }); var defaultCodeBase = TestSourcesUtility.GetDefaultCodebasePath(adapterSourceMap); Assert.AreEqual(defaultCodeBase, "c:\\folder1"); }
/// <summary> /// Sends Session-Start event on in-proc datacollectors /// </summary> protected override void SendSessionStart() { // Send session start with test sources in property bag for session start event args. if (this.testCaseEventsHandler == null) { return; } var properties = new Dictionary <string, object>(); properties.Add("TestSources", TestSourcesUtility.GetSources(this.testCases)); this.testCaseEventsHandler.SendSessionStart(properties); }
public void GetSourcesShouldGetDistinctSourcesFromTestCases() { var tests = new List <TestCase>() { new TestCase("test1", new Uri("e://d"), "source1.dll"), new TestCase("test2", new Uri("e://d"), "source2.dll"), new TestCase("test3", new Uri("e://d"), "source1.dll") }; var sources = TestSourcesUtility.GetSources(tests); Assert.AreEqual(2, sources.Count()); Assert.IsTrue(sources.Contains("source1.dll")); Assert.IsTrue(sources.Contains("source2.dll")); }
public void GetSourcesShouldAggregateSourcesIfMultiplePresentInAdapterSourceMap() { var adapterSourceMap = new Dictionary <string, IEnumerable <string> >(); adapterSourceMap.Add("adapter1", new List <string>() { "source1.dll", "source2.dll" }); adapterSourceMap.Add("adapter2", new List <string>() { "source1.dll", "source3.dll" }); adapterSourceMap.Add("adapter3", new List <string>() { "source1.dll" }); var sources = TestSourcesUtility.GetSources(adapterSourceMap); Assert.AreEqual(5, sources.Count()); Assert.IsTrue(sources.Contains("source1.dll")); Assert.IsTrue(sources.Contains("source2.dll")); Assert.IsTrue(sources.Contains("source3.dll")); }
/// <summary> /// Gets test sources from test run criteria /// </summary> /// <returns>test sources</returns> private IEnumerable <string> GetSourcesFromTestRunCriteria(TestRunCriteria testRunCriteria) { return(testRunCriteria.HasSpecificTests ? TestSourcesUtility.GetSources(testRunCriteria.Tests) : testRunCriteria.Sources); }
/// <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; } }