protected override void Before_all_tests() { base.Before_all_tests(); base.PathToIntegrationTestXap = TestXapFileLocations.XUnitSL3; this._clientTestRunConfiguration = new IntegrationTestClientTestRunConfiguration(UnitTestProviderType.Xunit); }
public PostHandler(ILogger logger, IEventPublisher eventPublisher, ClientTestRunConfiguration clientTestRunConfiguration, ResponseFactory responseFactory) { if (logger == null) { throw new ArgumentNullException("logger"); } if (eventPublisher == null) { throw new ArgumentNullException("eventPublisher"); } if (clientTestRunConfiguration == null) { throw new ArgumentNullException("clientTestRunConfiguration"); } _logger = logger; _eventPublisher = eventPublisher; _clientTestRunConfiguration = clientTestRunConfiguration; _responseFactory = responseFactory; MethodInfo makeGenericMethod = GetType().GetMethod("PublishIt", BindingFlags.Instance | BindingFlags.NonPublic); Type clientEventType = typeof(ClientEvent); _publishMethods = clientEventType .Assembly.GetTypes() .Where(w => w.Namespace == clientEventType.Namespace) .Where(w => w.Name.EndsWith("ClientEvent", StringComparison.OrdinalIgnoreCase)) .ToDictionary(key => key, value => makeGenericMethod.MakeGenericMethod(value)); }
internal ContinuousConsoleRunner( ILogger logger, IEventSubscriptionManager eventSubscriptionManager, IEventPublisher eventPublisher, string xapPath, ClientTestRunConfiguration clientTestRunConfiguration, IWebServer webServer, IWebBrowser webBrowser) { _xapPath = xapPath; _webServer = webServer; _xapFileBuildChangedMonitor = new XapFileBuildChangedMonitor(eventPublisher, _xapPath); _continuousRunnerThread = new Thread(() => { using (var runner = new ContinuousTestRunner(logger, eventSubscriptionManager, eventPublisher, webBrowser, clientTestRunConfiguration, _xapPath)) { string line; while (!(line = System.Console.ReadLine()).Equals("exit", StringComparison.OrdinalIgnoreCase)) { runner.ForceFilteredTest(line); } } }); }
protected override void Before_all_tests() { base.Before_all_tests(); var webServerLocation = new WebServerLocation(TestLogger, 38881); var consoleLogger = new ConsoleLogger(LogChatterLevels.Full); _hostXap = new byte[] { 5, 4, 2, 1, 4 }; var clientConfig = new ClientTestRunConfiguration(UnitTestProviderType.MSTest, new List <string>(), "", 1, WebBrowserType.SelfHosted, string.Empty, new WindowGeometry(), new List <string>()); _serializedConfiguration = clientConfig.Serialize(); var dummyServerTestRunConfiguration = GetDummyServerTestRunConfiguration(); var statLightConfiguration = new StatLightConfiguration(clientConfig, dummyServerTestRunConfiguration); var currentStatLightConfiguration = new CurrentStatLightConfiguration(statLightConfiguration); _responseFactory = new ResponseFactory(currentStatLightConfiguration); _mockPostHandler = new Mock <IPostHandler>(); _inMemoryWebServer = new InMemoryWebServer(consoleLogger, webServerLocation, _responseFactory, _mockPostHandler.Object, base.TestEventPublisher); _webClient = new WebClient(); _baseUrl = webServerLocation.BaseUrl.ToString(); _inMemoryWebServer.Start(); }
public IRunner CreateRemotelyHostedRunner(StatLightConfiguration statLightConfiguration) { if (statLightConfiguration == null) { throw new ArgumentNullException("statLightConfiguration"); } ClientTestRunConfiguration clientTestRunConfiguration = statLightConfiguration.Client; ServerTestRunConfiguration serverTestRunConfiguration = statLightConfiguration.Server; throw new NotImplementedException(); //var urlToTestPage = statLightConfiguration.Client.XapToTestUrl.ToUri(); //var location = new RemoteSiteOverriddenLocation(logger, urlToTestPage); //var debugAssertMonitorTimer = new TimerWrapper(serverTestRunConfiguration.DialogSmackDownElapseMilliseconds); //SetupDebugClientEventListener(logger); //var webServer = CreateWebServer(logger, statLightConfiguration, location); // //var showTestingBrowserHost = serverTestRunConfiguration.ShowTestingBrowserHost; // //var querystring = "?{0}={1}".FormatWith(StatLightServiceRestApi.StatLightResultPostbackUrl, // HttpUtility.UrlEncode(location.BaseUrl.ToString())); //var testPageUrlAndPostbackQuerystring = new Uri(location.TestPageUrl + querystring); //logger.Debug("testPageUrlAndPostbackQuerystring={0}".FormatWith(testPageUrlAndPostbackQuerystring.ToString())); //var webBrowsers = GetWebBrowsers(logger, testPageUrlAndPostbackQuerystring, clientTestRunConfiguration, showTestingBrowserHost, serverTestRunConfiguration.QueryString, statLightConfiguration.Server.ForceBrowserStart); // //var dialogMonitorRunner = SetupDialogMonitorRunner(logger, webBrowsers, debugAssertMonitorTimer); // //StartupBrowserCommunicationTimeoutMonitor(); //CreateAndAddConsoleResultHandlerToEventAggregator(logger); // //IRunner runner = new OnetimeRunner(logger, _eventSubscriptionManager, _eventPublisher, webServer, webBrowsers, statLightConfiguration.Server.XapToTestPath, dialogMonitorRunner); //return runner; }
/// <summary> /// Gets a collection of test method wrapper instances. /// </summary> /// <returns>A collection of test method interface objects.</returns> public ICollection <ITestMethod> GetTestMethods() { if (!_testsLoaded) { ICollection <MethodInfo> methods = GetTestMethods(_type); _tests = new List <ITestMethod>(methods.Count); foreach (MethodInfo method in methods) { if (ClientTestRunConfiguration.ContainsMethod(method)) { if (method.HasAttribute(NUnitAttributes.TestCase)) { var dynamicMethods = GetDynamicTestMethodsForTestCases(method); foreach (var dynamicMethod in dynamicMethods) { _tests.Add(dynamicMethod); } } else { _tests.Add(new TestMethod(method)); } } } _testsLoaded = true; } return(_tests); }
private ContinuousTestRunner CreateContinuousTestRunner() { var clientTestRunConfiguration = new ClientTestRunConfiguration(UnitTestProviderType.MSTest, new List <string>(), "", 1, WebBrowserType.SelfHosted, false, string.Empty); var runner = new ContinuousTestRunner(TestLogger, TestEventSubscriptionManager, TestEventPublisher, _mockWebBrowser.Object, clientTestRunConfiguration, "test"); return(runner); }
protected override void OnTestRunConfigurationDownloaded(ClientTestRunConfiguration clientTestRunConfiguration) { ILoadedXapData loadedXapData = new CurrentXapData(_assemblyToTest); TestRunnerHost.ConfigureWithLoadedXapData(loadedXapData); CompletedTestXapRequest = true; DisplayTestHarness(); }
private static IEnumerable <MethodTester> GetMethodTestersToRun(TestContext testContext) { return(testContext .Items .OfType <TestGroup>() .SelectMany(GetMethodTesters) .Where(w => ClientTestRunConfiguration.ContainsMethod(w.Method))); }
protected override void Before_all_tests() { base.Before_all_tests(); _clientTestRunConfiguration = new IntegrationTestClientTestRunConfiguration( new Collection <string> { "StatLight.IntegrationTests.Silverlight.When_trying_to_get_at_the_ServiceReferenceClientConfig.Should_be_able_to_read_info_from_the_ServiceReferenceClientConfig", }); }
protected override void OnTestRunConfigurationDownloaded(ClientTestRunConfiguration clientTestRunConfiguration) { var loadedXapData = new ThisXapData(clientTestRunConfiguration.EntryPointAssembly); Server.Debug("OnTestRunConfigurationDownloaded"); TestRunnerHost.ConfigureWithLoadedXapData(loadedXapData); CompletedTestXapRequest = true; DisplayTestHarness(); }
protected override void Before_all_tests() { base.Before_all_tests(); _clientTestRunConfiguration = new IntegrationTestClientTestRunConfiguration( new List <string> { "StatLight.IntegrationTests.Silverlight.SampleResourceFileTests.Should_be_able_to_read_the_local_xml_file_in_the_xap_under_test", "StatLight.IntegrationTests.Silverlight.SampleResourceFileTests.Should_be_able_to_read_the_local_xml_file_in_the_xap_under_test_contianed_within_nested_folders" }); }
protected override void Before_all_tests() { _mockWebBrowser = new Mock <IWebBrowser>(); base.Before_all_tests(); _clientTestRunConfiguration = new ClientTestRunConfiguration(UnitTestProviderType.MSTest, new List <string>(), "", 1, WebBrowserType.SelfHosted, false, string.Empty); _continuousTestRunner = new ContinuousTestRunner(TestLogger, TestEventSubscriptionManager, TestEventPublisher, _mockWebBrowser.Object, _clientTestRunConfiguration, "test"); // Signal that the first test has already finished. TestEventPublisher.SendMessage(new TestRunCompletedServerEvent()); }
protected override void Before_all_tests() { base.Before_all_tests(); const string prefix = "StatLight.IntegrationTests.Silverlight.NestedClassInheritanceTests.A+B"; _clientTestRunConfiguration = new IntegrationTestClientTestRunConfiguration( new List <string> { prefix + "1.MethodA", prefix + "2.MethodA", }); }
protected override void Before_all_tests() { base.Before_all_tests(); PathToIntegrationTestXap = TestXapFileLocations.MSTestSL3; _clientTestRunConfiguration = new IntegrationTestClientTestRunConfiguration(); EventSubscriptionManager .AddListener <InitializationOfUnitTestHarnessClientEvent>(e => _initializationOfUnitTestHarnessClientEvent = e) .AddListener <TestExecutionClassCompletedClientEvent>(e => _testExecutionClassCompletedClientEvent.Add(e)) .AddListener <TestExecutionMethodIgnoredClientEvent>(e => _testExecutionMethodIgnoredClientEvent.Add(e)) .AddListener <TestExecutionMethodFailedClientEvent>(e => _testExecutionMethodFailedClientEvent.Add(e)) .AddListener <TestExecutionMethodPassedClientEvent>(e => _testExecutionMethodPassedClientEvent.Add(e)) ; }
protected override void Before_all_tests() { base.Before_all_tests(); const string prefix = "StatLight.IntegrationTests.Silverlight.When_calling_debug_assert_with_each_overload"; clientTestRunConfiguration = new IntegrationTestClientTestRunConfiguration(new List <string> { prefix + ".debug_assert_overload_1", prefix + ".debug_assert_overload_2", prefix + ".debug_assert_overload_3", prefix + ".debug_assert_overload_4", }); }
protected override void Before_all_tests() { base.Before_all_tests(); const string prefix = "StatLight.IntegrationTests.Silverlight.When_a_modal_MessageBox_is_displayed"; clientTestRunConfiguration = new IntegrationTestClientTestRunConfiguration( new List <string> { prefix + ".messageBox_overload_1X", prefix + ".messageBox_overload_1_MessageBoxButton_OKX", prefix + ".messageBox_overload_1_MessageBoxButton_OKCancel", }); }
protected override void Before_all_tests() { base.Before_all_tests(); PathToIntegrationTestXap = TestXapFileLocations.NUnit; const string namespaceAndClass = "StatLight.IntegrationTests.Silverlight.NUnitTests."; _explicitTestName = "Should_only_run_Explicitly"; var fullTestName = namespaceAndClass + _explicitTestName; _clientTestRunConfiguration = new IntegrationTestClientTestRunConfiguration(UnitTestProviderType.NUnit, new List <string> { fullTestName, }); }
protected override void Before_all_tests() { base.Before_all_tests(); PathToIntegrationTestXap = TestXapFileLocations.NUnit; const string namespaceToTestFrom = "StatLight.IntegrationTests.Silverlight."; NormalClassTestName = "NUnitTests"; NestedClassTestName = "NUnitTests+NUnitNestedClassTests"; _clientTestRunConfiguration = new IntegrationTestClientTestRunConfiguration(UnitTestProviderType.NUnit, new List <string> { namespaceToTestFrom + NormalClassTestName + ".this_should_be_a_passing_test", namespaceToTestFrom + NestedClassTestName + ".this_should_be_a_passing_test", }); }
/// <summary> /// Gets a collection of test method wrapper instances. /// </summary> /// <returns>A collection of test method interface objects.</returns> public ICollection <ITestMethod> GetTestMethods() { if (!_testsLoaded) { var methods = GetTestMethods(_type); _tests = new List <ITestMethod>(methods.Count); foreach (MethodInfo method in methods) { if (ClientTestRunConfiguration.ContainsMethod(method)) { _tests.Add(new TestMethod(method)); } } _testsLoaded = true; } return(_tests); }
/// <summary> /// Gets a collection of test method wrapper instances. /// </summary> /// <returns>A collection of test method interface objects.</returns> public ICollection <ITestMethod> GetTestMethods() { if (!_testsLoaded) { ICollection <MethodInfo> methods = GetTestMethods(_type); _tests = new List <ITestMethod>(methods.Count); foreach (MethodInfo method in methods) { if (ClientTestRunConfiguration.ContainsMethod(method)) { // Using the MSTest frameworks's TestMethod here because // 1. There is no specific StatLight logic in the original ITestMethod implemenation done by StatLight // 2. The UnitTestContext class in the SL Testing Framework is protected and therefore I can't create that instance _tests.Add(new Microsoft.Silverlight.Testing.UnitTesting.Metadata.VisualStudio.TestMethod(method)); } } _testsLoaded = true; } return(_tests); }
protected override void Before_all_tests() { base.Before_all_tests(); var webServerLocation = new WebServerLocation(TestLogger, 38881); var consoleLogger = new ConsoleLogger(LogChatterLevels.Full); _hostXap = new byte[] { 5, 4, 2, 1, 4 }; var clientConfig = new ClientTestRunConfiguration(UnitTestProviderType.MSTest, new List <string>(), "", 1, WebBrowserType.SelfHosted, false, string.Empty); _serializedConfiguration = clientConfig.Serialize(); _responseFactory = new ResponseFactory(() => _hostXap, clientConfig); _mockPostHandler = new Mock <IPostHandler>(); _inMemoryWebServer = new Core.WebServer.InMemoryWebServer(consoleLogger, webServerLocation, _responseFactory, _mockPostHandler.Object); _webClient = new WebClient(); _baseUrl = webServerLocation.BaseUrl.ToString(); _inMemoryWebServer.Start(); }
internal ContinuousTestRunner( ILogger logger, IEventSubscriptionManager eventSubscriptionManager, IEventPublisher eventPublisher, IWebBrowser webBrowser, ClientTestRunConfiguration clientTestRunConfiguration, string xapPath) { _logger = logger; _eventSubscriptionManager = eventSubscriptionManager; _eventPublisher = eventPublisher; _webBrowser = webBrowser; _clientTestRunConfiguration = clientTestRunConfiguration; _xapPath = xapPath; _eventSubscriptionManager.AddListener(this); _logger.Debug("ContinuousTestRunner.ctor()"); Start(); }
private void BuildAndReturnWebServiceAndBrowser( ILogger logger, StatLightConfiguration statLightConfiguration, out IWebServer webServer, out List <IWebBrowser> webBrowsers, out IDialogMonitorRunner dialogMonitorRunner) { ClientTestRunConfiguration clientTestRunConfiguration = statLightConfiguration.Client; ServerTestRunConfiguration serverTestRunConfiguration = statLightConfiguration.Server; var location = new WebServerLocation(logger); var debugAssertMonitorTimer = new TimerWrapper(serverTestRunConfiguration.DialogSmackDownElapseMilliseconds); webServer = CreateWebServer(logger, statLightConfiguration, location); webBrowsers = GetWebBrowsers(logger, location.TestPageUrl, clientTestRunConfiguration, serverTestRunConfiguration.ShowTestingBrowserHost, serverTestRunConfiguration.QueryString, statLightConfiguration.Server.ForceBrowserStart); dialogMonitorRunner = SetupDialogMonitorRunner(logger, webBrowsers, debugAssertMonitorTimer); StartupBrowserCommunicationTimeoutMonitor(); }
protected override void Before_all_tests() { base.Before_all_tests(); PathToIntegrationTestXap = TestXapFileLocations.UnitDrivenSl3; _clientTestRunConfiguration = new IntegrationTestClientTestRunConfiguration(UnitTestProviderType.UnitDriven); }
private static IEnumerable <MethodTester> GetMethodTestersToRun(TestContext testContext) { return(GetMethodTesters(testContext).Where(w => ClientTestRunConfiguration.ContainsMethod(w.Method.MethodInfo))); }
protected abstract void OnTestRunConfigurationDownloaded(ClientTestRunConfiguration clientTestRunConfiguration);
public ResponseFactory(Func <byte[]> hostXapFactory, ClientTestRunConfiguration clientTestRunConfiguration) { _hostXapFactory = hostXapFactory; _serializedConfiguration = clientTestRunConfiguration.Serialize(); }
private static List <IWebBrowser> GetWebBrowsers(ILogger logger, Uri testPageUrl, ClientTestRunConfiguration clientTestRunConfiguration, bool showTestingBrowserHost, string queryString, bool forceBrowserStart) { var webBrowserType = clientTestRunConfiguration.WebBrowserType; var webBrowserFactory = new WebBrowserFactory(logger); var testPageUrlWithQueryString = new Uri(testPageUrl + "?" + queryString); logger.Debug("testPageUrlWithQueryString = " + testPageUrlWithQueryString); List <IWebBrowser> webBrowsers = Enumerable .Range(1, clientTestRunConfiguration.NumberOfBrowserHosts) .Select(browserI => webBrowserFactory.Create(webBrowserType, testPageUrlWithQueryString, showTestingBrowserHost, forceBrowserStart, clientTestRunConfiguration.NumberOfBrowserHosts > 1)) .ToList(); return(webBrowsers); }
public void ConfigureWithClientTestRunConfiguration(ClientTestRunConfiguration clientTestRunConfiguration) { _clientTestRunConfiguration = clientTestRunConfiguration; }