protected override void OnTestRunConfigurationDownloaded(ClientTestRunConfiguration clientTestRunConfiguration)
 {
     ILoadedXapData loadedXapData = new CurrentXapData(_assemblyToTest);
     TestRunnerHost.ConfigureWithLoadedXapData(loadedXapData);
     CompletedTestXapRequest = true;
     DisplayTestHarness();
 }
        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);
                    }
                }
            });
        }
Ejemplo n.º 3
0
        public StatLightConfiguration(ClientTestRunConfiguration clientConfig, ServerTestRunConfiguration serverConfig)
        {
            if (clientConfig == null) throw new ArgumentNullException("clientConfig");
            if (serverConfig == null) throw new ArgumentNullException("serverConfig");

            Client = clientConfig;
            Server = serverConfig;
        }
Ejemplo n.º 4
0
        protected override void OnTestRunConfigurationDownloaded(ClientTestRunConfiguration clientTestRunConfiguration)
        {
            var loadedXapData = new ThisXapData(clientTestRunConfiguration.EntryPointAssembly, clientTestRunConfiguration.TestAssemblyFormalNames);
            Server.Debug("OnTestRunConfigurationDownloaded");
            TestRunnerHost.ConfigureWithLoadedXapData(loadedXapData);

            CompletedTestXapRequest = true;
            DisplayTestHarness();
        }
Ejemplo n.º 5
0
        public StatLightConfiguration GetStatLightConfigurationForDll(UnitTestProviderType unitTestProviderType, string dllPath, MicrosoftTestingFrameworkVersion?microsoftTestingFrameworkVersion, Collection <string> methodsToTest, string tagFilters, int numberOfBrowserHosts, bool isRemoteRun, string queryString, WebBrowserType webBrowserType, bool forceBrowserStart, bool showTestingBrowserHost)
        {
            if (queryString == null)
            {
                throw new ArgumentNullException("queryString");
            }

            Func <IEnumerable <ITestFile> > filesToCopyIntoHostXap = () => new List <ITestFile>();
            string entryPointAssembly = string.Empty;
            string runtimeVersion     = null;

            if (isRemoteRun)
            {
            }
            else
            {
                AssertFileExists(dllPath);

                var dllFileInfo         = new FileInfo(dllPath);
                var assemblyResolver    = new AssemblyResolver(_logger);
                var dependentAssemblies = assemblyResolver.ResolveAllDependentAssemblies(dllFileInfo.FullName);

                var coreFileUnderTest       = new TestFile(dllFileInfo.FullName);
                var dependentFilesUnderTest = dependentAssemblies.Select(file => new TestFile(file)).ToList();
                dependentFilesUnderTest.Add(coreFileUnderTest);
                var xapReadItems = new TestFileCollection(_logger,
                                                          AssemblyName.GetAssemblyName(dllFileInfo.FullName).ToString(),
                                                          dependentFilesUnderTest);

                SetupUnitTestProviderType(xapReadItems, ref unitTestProviderType, ref microsoftTestingFrameworkVersion);

                entryPointAssembly = xapReadItems.TestAssemblyFullName;

                filesToCopyIntoHostXap = () =>
                {
                    return(new TestFileCollection(_logger,
                                                  AssemblyName.GetAssemblyName(dllFileInfo.FullName)
                                                  .ToString(),
                                                  dependentFilesUnderTest).FilesContainedWithinXap);
                };
            }

            var clientConfig = new ClientTestRunConfiguration(unitTestProviderType, methodsToTest, tagFilters, numberOfBrowserHosts, webBrowserType, showTestingBrowserHost, entryPointAssembly);

            var serverConfig = CreateServerConfiguration(
                dllPath,
                clientConfig.UnitTestProviderType,
                microsoftTestingFrameworkVersion,
                filesToCopyIntoHostXap,
                DefaultDialogSmackDownElapseMilliseconds,
                queryString,
                forceBrowserStart,
                showTestingBrowserHost,
                runtimeVersion);

            return(new StatLightConfiguration(clientConfig, serverConfig));
        }
        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",
                    });
        }
Ejemplo n.º 7
0
        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()
        {
            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",
                   });
        }
Ejemplo n.º 9
0
        public StatLightConfiguration GetStatLightConfigurationForXap(UnitTestProviderType unitTestProviderType, string xapPath, MicrosoftTestingFrameworkVersion?microsoftTestingFrameworkVersion, Collection <string> methodsToTest, string tagFilters, int numberOfBrowserHosts, bool isRemoteRun, string queryString, WebBrowserType webBrowserType, bool forceBrowserStart, bool showTestingBrowserHost)
        {
            if (queryString == null)
            {
                throw new ArgumentNullException("queryString");
            }

            if (showTestingBrowserHost && !Environment.UserInteractive)
            {
                throw new StatLightException("You cannot use the -b option as your C.I. server's agent process is not running in desktop interactive mode.");
            }

            Func <IEnumerable <ITestFile> > filesToCopyIntoHostXap = () => new List <ITestFile>();
            string runtimeVersion     = null;
            string entryPointAssembly = string.Empty;

            if (isRemoteRun)
            {
            }
            else
            {
                AssertFileExists(xapPath);

                var xapReader = new XapReader(_logger);

                TestFileCollection testFileCollection = xapReader.LoadXapUnderTest(xapPath);
                runtimeVersion = XapReader.GetRuntimeVersion(xapPath);

                SetupUnitTestProviderType(testFileCollection, ref unitTestProviderType, ref microsoftTestingFrameworkVersion);

                entryPointAssembly = testFileCollection.TestAssemblyFullName;

                filesToCopyIntoHostXap = () =>
                {
                    return(xapReader.LoadXapUnderTest(xapPath).FilesContainedWithinXap);
                };
            }

            var clientConfig = new ClientTestRunConfiguration(unitTestProviderType, methodsToTest, tagFilters, numberOfBrowserHosts, webBrowserType, showTestingBrowserHost, entryPointAssembly);

            var serverConfig = CreateServerConfiguration(
                xapPath,
                clientConfig.UnitTestProviderType,
                microsoftTestingFrameworkVersion,
                filesToCopyIntoHostXap,
                DefaultDialogSmackDownElapseMilliseconds,
                queryString,
                forceBrowserStart,
                showTestingBrowserHost,
                runtimeVersion);

            return(new StatLightConfiguration(clientConfig, serverConfig));
        }
        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, null);
            _continuousTestRunner = new ContinuousTestRunner(TestLogger, TestEventSubscriptionManager, TestEventPublisher, _mockWebBrowser.Object, _clientTestRunConfiguration, "test");

            // Signal that the first test has already finished.
            TestEventPublisher.SendMessage(new TestRunCompletedServerEvent());
        }
Ejemplo n.º 11
0
        private StatLightConfiguration GetStatLightConfigurationForDll(string dllPath)
        {
            Func <IEnumerable <ITestFile> > filesToCopyIntoHostXap = () => new List <ITestFile>();
            string entryPointAssembly = string.Empty;
            string runtimeVersion     = null;
            IEnumerable <string> testAssemblyFormalNames = new List <string>();

            var dllFileInfo         = new FileInfo(dllPath);
            var assemblyResolver    = new AssemblyResolver();
            var dependentAssemblies = assemblyResolver.ResolveAllDependentAssemblies(_options.IsPhoneRun, dllFileInfo.FullName);

            var coreFileUnderTest       = new TestFile(dllFileInfo.FullName);
            var dependentFilesUnderTest = dependentAssemblies.Select(file => new TestFile(file)).ToList();

            dependentFilesUnderTest.Add(coreFileUnderTest);
            var testFileCollection = new TestFileCollection(_logger,
                                                            AssemblyName.GetAssemblyName(dllFileInfo.FullName).ToString(),
                                                            dependentFilesUnderTest);

            testAssemblyFormalNames = testFileCollection.GetAssemblyNames();

            UnitTestProviderType             unitTestProviderType             = _options.UnitTestProviderType;
            MicrosoftTestingFrameworkVersion?microsoftTestingFrameworkVersion = _options.MicrosoftTestingFrameworkVersion;

            SetupUnitTestProviderType(testFileCollection, ref unitTestProviderType, ref microsoftTestingFrameworkVersion);

            entryPointAssembly = testFileCollection.TestAssemblyFullName;

            filesToCopyIntoHostXap = () =>
            {
                return(new TestFileCollection(_logger,
                                              AssemblyName.GetAssemblyName(dllFileInfo.FullName)
                                              .ToString(),
                                              dependentFilesUnderTest).FilesContainedWithinXap);
            };

            var clientConfig = new ClientTestRunConfiguration(unitTestProviderType, _options.MethodsToTest, _options.TagFilters, _options.NumberOfBrowserHosts, _options.WebBrowserType, entryPointAssembly, _options.WindowGeometry, testAssemblyFormalNames);

            var serverConfig = CreateServerConfiguration(
                dllPath,
                clientConfig.UnitTestProviderType,
                microsoftTestingFrameworkVersion,
                filesToCopyIntoHostXap,
                _options.QueryString,
                _options.ForceBrowserStart,
                _options.WindowGeometry,
                runtimeVersion,
                _options.IsPhoneRun);

            return(new StatLightConfiguration(clientConfig, serverConfig));
        }
Ejemplo n.º 12
0
        public StatLightConfiguration(ClientTestRunConfiguration clientConfig, ServerTestRunConfiguration serverConfig)
        {
            if (clientConfig == null)
            {
                throw new ArgumentNullException("clientConfig");
            }
            if (serverConfig == null)
            {
                throw new ArgumentNullException("serverConfig");
            }

            Client = clientConfig;
            Server = serverConfig;
        }
Ejemplo n.º 13
0
        private StatLightConfiguration GetStatLightConfigurationForXap(string xapPath)
        {
            Func <IEnumerable <ITestFile> > filesToCopyIntoHostXap = () => new List <ITestFile>();
            string runtimeVersion = null;
            IEnumerable <string> testAssemblyFormalNames = new List <string>();
            string entryPointAssembly = string.Empty;

            var xapReader = new XapReader(_logger);

            TestFileCollection testFileCollection = xapReader.LoadXapUnderTest(xapPath);

            runtimeVersion = XapReader.GetRuntimeVersion(xapPath);

            UnitTestProviderType             unitTestProviderType             = _options.UnitTestProviderType;
            MicrosoftTestingFrameworkVersion?microsoftTestingFrameworkVersion = _options.MicrosoftTestingFrameworkVersion;

            SetupUnitTestProviderType(testFileCollection, ref unitTestProviderType, ref microsoftTestingFrameworkVersion);

            entryPointAssembly      = testFileCollection.TestAssemblyFullName;
            testAssemblyFormalNames = testFileCollection.GetAssemblyNames();

            filesToCopyIntoHostXap = () =>
            {
                return(xapReader.LoadXapUnderTest(xapPath).FilesContainedWithinXap);
            };

            var clientConfig = new ClientTestRunConfiguration(
                unitTestProviderType: unitTestProviderType,
                methodsToTest: _options.MethodsToTest,
                tagFilters: _options.TagFilters,
                numberOfBrowserHosts: _options.NumberOfBrowserHosts,
                webBrowserType: _options.WebBrowserType,
                entryPointAssembly: entryPointAssembly,
                windowGeometry: _options.WindowGeometry,
                testAssemblyFormalNames: testAssemblyFormalNames);

            var serverConfig = CreateServerConfiguration(
                xapPath,
                unitTestProviderType,
                microsoftTestingFrameworkVersion,
                filesToCopyIntoHostXap,
                _options.QueryString,
                _options.ForceBrowserStart,
                _options.WindowGeometry,
                runtimeVersion,
                _options.IsPhoneRun);

            return(new StatLightConfiguration(clientConfig, serverConfig));
        }
        public StatLightConfiguration GetStatLightConfigurationForDll(UnitTestProviderType unitTestProviderType, string dllPath, MicrosoftTestingFrameworkVersion? microsoftTestingFrameworkVersion, Collection<string> methodsToTest, string tagFilters, int numberOfBrowserHosts, bool isRemoteRun, string queryString, WebBrowserType webBrowserType, bool forceBrowserStart, bool showTestingBrowserHost)
        {
            if (queryString == null)
                throw new ArgumentNullException("queryString");

            IEnumerable<ITestFile> filesToCopyIntoHostXap = new List<ITestFile>();
            string entryPointAssembly = string.Empty;
            if (isRemoteRun)
            {
            }
            else
            {
                AssertFileExists(dllPath);

                var dllFileInfo = new FileInfo(dllPath);

                var assemblyResolver = new AssemblyResolver(_logger, dllFileInfo.Directory);
                var dependentAssemblies = assemblyResolver.ResolveAllDependentAssemblies(dllFileInfo.FullName);

                var coreFileUnderTest = new TestFile(dllFileInfo.FullName);
                var dependentFilesUnderTest = dependentAssemblies.Select(file => new TestFile(file)).ToList();
                dependentFilesUnderTest.Add(coreFileUnderTest);

                var xapReadItems = new TestFileCollection(_logger,
                                                          AssemblyName.GetAssemblyName(dllFileInfo.FullName).ToString(),
                                                          dependentFilesUnderTest);

                SetupUnitTestProviderType(xapReadItems, ref unitTestProviderType, ref microsoftTestingFrameworkVersion);

                entryPointAssembly = xapReadItems.TestAssemblyFullName;

                filesToCopyIntoHostXap = xapReadItems.FilesContainedWithinXap;
            }

            var clientConfig = new ClientTestRunConfiguration(unitTestProviderType, methodsToTest, tagFilters, numberOfBrowserHosts, webBrowserType, showTestingBrowserHost, entryPointAssembly);

            var serverConfig = CreateServerConfiguration(
                dllPath,
                clientConfig.UnitTestProviderType,
                microsoftTestingFrameworkVersion,
                filesToCopyIntoHostXap,
                DefaultDialogSmackDownElapseMilliseconds,
                queryString,
                forceBrowserStart,
                showTestingBrowserHost);

            return new StatLightConfiguration(clientConfig, serverConfig);
        }
        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",
                        });
        }
        public StatLightConfiguration GetStatLightConfigurationForXap(UnitTestProviderType unitTestProviderType, string xapPath, MicrosoftTestingFrameworkVersion?microsoftTestingFrameworkVersion, Collection <string> methodsToTest, string tagFilters, int numberOfBrowserHosts, bool isRemoteRun, string queryString, WebBrowserType webBrowserType, bool forceBrowserStart, bool showTestingBrowserHost)
        {
            if (queryString == null)
            {
                throw new ArgumentNullException("queryString");
            }

            IEnumerable <ITestFile> filesToCopyIntoHostXap = new List <ITestFile>();
            string entryPointAssembly = string.Empty;

            if (isRemoteRun)
            {
            }
            else
            {
                AssertFileExists(xapPath);

                var xapReader = new XapReader(_logger);

                TestFileCollection testFileCollection = xapReader.LoadXapUnderTest(xapPath);

                SetupUnitTestProviderType(testFileCollection, ref unitTestProviderType, ref microsoftTestingFrameworkVersion);

                entryPointAssembly = testFileCollection.TestAssemblyFullName;

                filesToCopyIntoHostXap = testFileCollection.FilesContainedWithinXap;
            }

            var clientConfig = new ClientTestRunConfiguration(unitTestProviderType, methodsToTest, tagFilters, numberOfBrowserHosts, webBrowserType, showTestingBrowserHost, entryPointAssembly);

            var serverConfig = CreateServerConfiguration(
                xapPath,
                clientConfig.UnitTestProviderType,
                microsoftTestingFrameworkVersion,
                filesToCopyIntoHostXap,
                DefaultDialogSmackDownElapseMilliseconds,
                queryString,
                forceBrowserStart,
                showTestingBrowserHost);

            return(new StatLightConfiguration(clientConfig, serverConfig));
        }
Ejemplo n.º 17
0
 public void ConfigureWithClientTestRunConfiguration(ClientTestRunConfiguration clientTestRunConfiguration)
 {
     _clientTestRunConfiguration = clientTestRunConfiguration;
 }
        public StatLightConfiguration GetStatLightConfigurationForXap(UnitTestProviderType unitTestProviderType, string xapPath, MicrosoftTestingFrameworkVersion? microsoftTestingFrameworkVersion, Collection<string> methodsToTest, string tagFilters, int numberOfBrowserHosts, bool isRemoteRun, string queryString, WebBrowserType webBrowserType, bool forceBrowserStart, bool showTestingBrowserHost)
        {
            if (queryString == null)
                throw new ArgumentNullException("queryString");

            Func<IEnumerable<ITestFile>> filesToCopyIntoHostXap = () => new List<ITestFile>();
            string runtimeVersion = null;
            string entryPointAssembly = string.Empty;
            if (isRemoteRun)
            {
            }
            else
            {
                AssertFileExists(xapPath);

                var xapReader = new XapReader(_logger);

                TestFileCollection testFileCollection = xapReader.LoadXapUnderTest(xapPath);
                runtimeVersion = XapReader.GetRuntimeVersion(xapPath);

                SetupUnitTestProviderType(testFileCollection, ref unitTestProviderType, ref microsoftTestingFrameworkVersion);

                entryPointAssembly = testFileCollection.TestAssemblyFullName;

                filesToCopyIntoHostXap = () =>
                {
                    return xapReader.LoadXapUnderTest(xapPath).FilesContainedWithinXap;
                };

            }

            var clientConfig = new ClientTestRunConfiguration(unitTestProviderType, methodsToTest, tagFilters, numberOfBrowserHosts, webBrowserType, showTestingBrowserHost, entryPointAssembly);

            var serverConfig = CreateServerConfiguration(
                xapPath,
                clientConfig.UnitTestProviderType,
                microsoftTestingFrameworkVersion,
                filesToCopyIntoHostXap,
                DefaultDialogSmackDownElapseMilliseconds,
                queryString,
                forceBrowserStart,
                showTestingBrowserHost,
                runtimeVersion);

            return new StatLightConfiguration(clientConfig, serverConfig);
        }
Ejemplo n.º 19
0
        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, null);
            _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();
        }
Ejemplo n.º 20
0
 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;
 }
        protected override void Before_all_tests()
        {
            base.Before_all_tests();

            base.PathToIntegrationTestXap = TestXapFileLocations.XUnit;
            this._clientTestRunConfiguration = new IntegrationTestClientTestRunConfiguration(UnitTestProviderType.XUnit);
        }
        private StatLightConfiguration GetStatLightConfigurationForXap(string xapPath)
        {
            Func<IEnumerable<ITestFile>> filesToCopyIntoHostXap = () => new List<ITestFile>();
            string runtimeVersion = null;
            string entryPointAssembly = string.Empty;

            var xapReader = new XapReader(_logger);

            TestFileCollection testFileCollection = xapReader.LoadXapUnderTest(xapPath);
            runtimeVersion = XapReader.GetRuntimeVersion(xapPath);

            UnitTestProviderType unitTestProviderType = _options.UnitTestProviderType;
            MicrosoftTestingFrameworkVersion? microsoftTestingFrameworkVersion = _options.MicrosoftTestingFrameworkVersion;

            SetupUnitTestProviderType(testFileCollection, ref unitTestProviderType, ref microsoftTestingFrameworkVersion);

            entryPointAssembly = testFileCollection.TestAssemblyFullName;

            filesToCopyIntoHostXap = () =>
            {
                return xapReader.LoadXapUnderTest(xapPath).FilesContainedWithinXap;
            };

            var clientConfig = new ClientTestRunConfiguration(unitTestProviderType, _options.MethodsToTest, _options.TagFilters, _options.NumberOfBrowserHosts, _options.WebBrowserType, entryPointAssembly, _options.WindowGeometry);

            var serverConfig = CreateServerConfiguration(
                xapPath,
                clientConfig.UnitTestProviderType,
                microsoftTestingFrameworkVersion,
                filesToCopyIntoHostXap,
                _options.QueryString,
                _options.ForceBrowserStart,
                _options.WindowGeometry,
                runtimeVersion);

            return new StatLightConfiguration(clientConfig, serverConfig);
        }
Ejemplo n.º 23
0
 public ResponseFactory(Func<byte[]> hostXapFactory, ClientTestRunConfiguration clientTestRunConfiguration)
 {
     _hostXapFactory = hostXapFactory;
     _serializedConfiguration = clientTestRunConfiguration.Serialize();
 }
        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))
                ;
        }
        private StatLightConfiguration GetStatLightConfigurationForDll(string dllPath)
        {
            Func<IEnumerable<ITestFile>> filesToCopyIntoHostXap = () => new List<ITestFile>();
            string entryPointAssembly = string.Empty;
            string runtimeVersion = null;

            var dllFileInfo = new FileInfo(dllPath);
            var assemblyResolver = new AssemblyResolver(_logger);
            var dependentAssemblies = assemblyResolver.ResolveAllDependentAssemblies(dllFileInfo.FullName);

            var coreFileUnderTest = new TestFile(dllFileInfo.FullName);
            var dependentFilesUnderTest = dependentAssemblies.Select(file => new TestFile(file)).ToList();
            dependentFilesUnderTest.Add(coreFileUnderTest);
            var xapReadItems = new TestFileCollection(_logger,
                                                        AssemblyName.GetAssemblyName(dllFileInfo.FullName).ToString(),
                                                        dependentFilesUnderTest);

            UnitTestProviderType unitTestProviderType = _options.UnitTestProviderType;
            MicrosoftTestingFrameworkVersion? microsoftTestingFrameworkVersion = _options.MicrosoftTestingFrameworkVersion;

            SetupUnitTestProviderType(xapReadItems, ref unitTestProviderType, ref microsoftTestingFrameworkVersion);

            entryPointAssembly = xapReadItems.TestAssemblyFullName;

            filesToCopyIntoHostXap = () =>
                                        {
                                            return new TestFileCollection(_logger,
                                                                    AssemblyName.GetAssemblyName(dllFileInfo.FullName)
                                                                        .ToString(),
                                                                    dependentFilesUnderTest).FilesContainedWithinXap;
                                        };

            var clientConfig = new ClientTestRunConfiguration(unitTestProviderType, _options.MethodsToTest, _options.TagFilters, _options.NumberOfBrowserHosts, _options.WebBrowserType, entryPointAssembly, _options.WindowGeometry);

            var serverConfig = CreateServerConfiguration(
                dllPath,
                clientConfig.UnitTestProviderType,
                microsoftTestingFrameworkVersion,
                filesToCopyIntoHostXap,
                _options.QueryString,
                _options.ForceBrowserStart,
                _options.WindowGeometry,
                runtimeVersion);

            return new StatLightConfiguration(clientConfig, serverConfig);
        }
Ejemplo n.º 26
0
        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.UnitDriven;
     _clientTestRunConfiguration = new IntegrationTestClientTestRunConfiguration(UnitTestProviderType.UnitDriven);
 }
Ejemplo n.º 28
0
        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();
        }
 private ContinuousTestRunner CreateContinuousTestRunner()
 {
     var clientTestRunConfiguration = new ClientTestRunConfiguration(UnitTestProviderType.MSTest, new List<string>(), "", 1, WebBrowserType.SelfHosted, false, string.Empty, null);
     var runner = new ContinuousTestRunner(TestLogger, TestEventSubscriptionManager, TestEventPublisher, _mockWebBrowser.Object, clientTestRunConfiguration, "test");
     return runner;
 }