public InputOptions() { // Setup some "sane" defaults WindowGeometry = new WindowGeometry(); UseRemoteTestPage = false; MethodsToTest = new List <string>(); MicrosoftTestingFrameworkVersion = null; TagFilters = String.Empty; UnitTestProviderType = UnitTestProviderType.Undefined; NumberOfBrowserHosts = 1; QueryString = String.Empty; WebBrowserType = WebBrowserType.SelfHosted; ForceBrowserStart = true; XapPaths = new List <string>(); DllPaths = new List <string>(); ExtensionDllPaths = new List <string>(); ReportOutputPath = String.Empty; ReportOutputFileType = ReportOutputFileType.StatLight; ContinuousIntegrationMode = false; OutputForTeamCity = false; StartWebServerOnly = false; IsRequestingDebug = false; SettingsOverride = new Dictionary <string, string>(); IsPhoneRun = false; }
public ClientTestRunConfiguration(UnitTestProviderType unitTestProviderType, IEnumerable <string> methodsToTest, string tagFilters, int numberOfBrowserHosts, WebBrowserType webBrowserType, string entryPointAssembly, WindowGeometry windowGeometry, IEnumerable <string> testAssemblyFormalNames) { if (methodsToTest == null) { throw new ArgumentNullException("methodsToTest"); } if (entryPointAssembly == null) { throw new ArgumentNullException("entryPointAssembly"); } if (unitTestProviderType == UnitTestProviderType.Undefined) { throw new ArgumentException("Must be defined", "unitTestProviderType"); } if (numberOfBrowserHosts <= 0) { throw new ArgumentOutOfRangeException("numberOfBrowserHosts", "Must be greater than 0"); } //if (testAssemblyFormalNames.Count() == 0) // throw new ArgumentException("must have some assemblies specified", "testAssemblyFormalNames"); _methodsToTest = methodsToTest.ToCollection(); _tagFilters = tagFilters ?? string.Empty; UnitTestProviderType = unitTestProviderType; NumberOfBrowserHosts = numberOfBrowserHosts; WebBrowserType = webBrowserType; EntryPointAssembly = entryPointAssembly; WindowGeometry = windowGeometry; _testAssemblyFormalNames = new Collection <string>(testAssemblyFormalNames.ToList()); }
public InputOptions() { // Setup some "sane" defaults WindowGeometry = new WindowGeometry(); UseRemoteTestPage = false; MethodsToTest = new List<string>(); MicrosoftTestingFrameworkVersion = null; TagFilters = String.Empty; UnitTestProviderType = UnitTestProviderType.Undefined; NumberOfBrowserHosts = 1; QueryString = String.Empty; WebBrowserType = WebBrowserType.SelfHosted; ForceBrowserStart = true; XapPaths = new List<string>(); DllPaths = new List<string>(); ExtensionDllPaths = new List<string>(); ReportOutputPath = String.Empty; ReportOutputFileType = ReportOutputFileType.StatLight; ContinuousIntegrationMode = false; OutputForTeamCity = false; StartWebServerOnly = false; IsRequestingDebug = false; SettingsOverride = new Dictionary<string, string>(); IsPhoneRun = false; }
public void Should_determine_minimized_correctly() { var windowGeometry = new WindowGeometry { State = BrowserWindowState.Minimized }; windowGeometry.ShouldShowWindow.ShouldBeFalse(); }
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, WindowGeometry windowGeometry) { 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, windowGeometry); var serverConfig = CreateServerConfiguration( dllPath, clientConfig.UnitTestProviderType, microsoftTestingFrameworkVersion, filesToCopyIntoHostXap, DefaultDialogSmackDownElapseMilliseconds, queryString, forceBrowserStart, showTestingBrowserHost, runtimeVersion); return new StatLightConfiguration(clientConfig, serverConfig); }
private static InputOptions CreateStatLightInputOptions(SilverlightTask silverlightTask, MethodTask[] testMethods) { var windowGeometry = new WindowGeometry(); windowGeometry.State = BrowserWindowState.Normal; return new InputOptions() .SetWindowGeometry(windowGeometry) .SetXapPaths(silverlightTask.GetXapPaths()) .SetDllPaths(silverlightTask.GetDllPaths()) .SetMethodsToTest(testMethods.Select(m => m.GetFullMethodName()).ToList()); }
public SelfHostedWebBrowser(ILogger logger, Uri pageToHost, bool browserVisible, WindowGeometry windowGeometry) { if (logger == null) throw new ArgumentNullException("logger"); if (pageToHost == null) throw new ArgumentNullException("pageToHost"); if (windowGeometry == null) throw new ArgumentNullException("windowGeometry"); _logger = logger; _pageToHost = pageToHost; _browserVisible = browserVisible; _windowGeometry = windowGeometry; }
public ServerTestRunConfiguration(Func<byte[]> xapHost, string xapToTest, XapHostType xapHostType, string queryString, bool forceBrowserStart, WindowGeometry windowGeometry) { if (xapHost == null) throw new ArgumentNullException("xapHost"); if (xapToTest == null) throw new ArgumentNullException("xapToTest"); HostXap = xapHost; XapToTestPath = xapToTest; XapHostType = xapHostType; QueryString = queryString; ForceBrowserStart = forceBrowserStart; WindowGeometry = windowGeometry; }
public SelfHostedWebBrowser(ILogger logger, Uri pageToHost, bool browserVisible, WindowGeometry windowGeometry) { _logger = logger; _pageToHost = pageToHost; _browserVisible = browserVisible; if (windowGeometry == null) { _windowGeometry = new WindowGeometry() { WindowSize = new StatLight.Core.Configuration.Size(800, 600), WindowState = BrowserWindowState.Normal }; } else { _windowGeometry = windowGeometry; } }
public InputOptions SetWindowGeometry(WindowGeometry windowGeometry) { if (windowGeometry == null) { throw new ArgumentNullException("windowGeometry"); } if (windowGeometry.ShouldShowWindow && !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."); } WindowGeometry = windowGeometry; return(this); }
public IWebBrowser Create(WebBrowserType browserType, Uri pageToHost, bool forceBrowserStart, bool isStartingMultipleInstances, WindowGeometry windowGeometry) { switch (browserType) { case WebBrowserType.SelfHosted: return new SelfHostedWebBrowser(_logger, pageToHost, windowGeometry.ShouldShowWindow, windowGeometry); case WebBrowserType.Firefox: return new FirefoxWebBrowser(_logger, pageToHost, forceBrowserStart, isStartingMultipleInstances); case WebBrowserType.Chrome: return new ChromeWebBrowser(_logger, pageToHost, forceBrowserStart, isStartingMultipleInstances); } throw new NotImplementedException(); }
public ClientTestRunConfiguration(UnitTestProviderType unitTestProviderType, IEnumerable<string> methodsToTest, string tagFilters, int numberOfBrowserHosts, WebBrowserType webBrowserType, string entryPointAssembly, WindowGeometry windowGeometry) { if (methodsToTest == null) throw new ArgumentNullException("methodsToTest"); if (unitTestProviderType == UnitTestProviderType.Undefined) throw new ArgumentException("Must be defined", "unitTestProviderType"); if (numberOfBrowserHosts <= 0) throw new ArgumentOutOfRangeException("numberOfBrowserHosts", "Must be greater than 0"); _methodsToTest = methodsToTest.ToCollection(); _tagFilters = tagFilters ?? string.Empty; UnitTestProviderType = unitTestProviderType; NumberOfBrowserHosts = numberOfBrowserHosts; WebBrowserType = webBrowserType; EntryPointAssembly = entryPointAssembly; WindowGeometry = windowGeometry; }
public ServerTestRunConfiguration(Func <byte[]> xapHost, string xapToTest, XapHostType xapHostType, string queryString, bool forceBrowserStart, WindowGeometry windowGeometry) { if (xapHost == null) { throw new ArgumentNullException("xapHost"); } if (xapToTest == null) { throw new ArgumentNullException("xapToTest"); } HostXap = xapHost; XapToTestPath = xapToTest; XapHostType = xapHostType; QueryString = queryString; ForceBrowserStart = forceBrowserStart; WindowGeometry = windowGeometry; }
private ServerTestRunConfiguration CreateServerConfiguration( string xapPath, UnitTestProviderType unitTestProviderType, MicrosoftTestingFrameworkVersion? microsoftTestingFrameworkVersion, Func<IEnumerable<ITestFile>> filesToCopyIntoHostXapFunc, string queryString, bool forceBrowserStart, WindowGeometry windowGeometry, string runtimeVersion) { XapHostType xapHostType = _xapHostFileLoaderFactory.MapToXapHostType(unitTestProviderType, microsoftTestingFrameworkVersion); Func<byte[]> hostXapFactory = () => { byte[] hostXap = _xapHostFileLoaderFactory.LoadXapHostFor(xapHostType); hostXap = RewriteXapWithSpecialFiles(hostXap, filesToCopyIntoHostXapFunc, runtimeVersion); return hostXap; }; return new ServerTestRunConfiguration(hostXapFactory, xapPath, xapHostType, queryString, forceBrowserStart, windowGeometry); }
private ServerTestRunConfiguration CreateServerConfiguration( string xapPath, UnitTestProviderType unitTestProviderType, MicrosoftTestingFrameworkVersion?microsoftTestingFrameworkVersion, Func <IEnumerable <ITestFile> > filesToCopyIntoHostXapFunc, string queryString, bool forceBrowserStart, WindowGeometry windowGeometry, string runtimeVersion) { XapHostType xapHostType = _xapHostFileLoaderFactory.MapToXapHostType(unitTestProviderType, microsoftTestingFrameworkVersion); Func <byte[]> hostXapFactory = () => { byte[] hostXap = _xapHostFileLoaderFactory.LoadXapHostFor(xapHostType); hostXap = RewriteXapWithSpecialFiles(hostXap, filesToCopyIntoHostXapFunc, runtimeVersion); return(hostXap); }; return(new ServerTestRunConfiguration(hostXapFactory, xapPath, xapHostType, queryString, forceBrowserStart, windowGeometry)); }
public ClientTestRunConfiguration(UnitTestProviderType unitTestProviderType, IEnumerable<string> methodsToTest, string tagFilters, int numberOfBrowserHosts, WebBrowserType webBrowserType, string entryPointAssembly, WindowGeometry windowGeometry, IEnumerable<string> testAssemblyFormalNames) { if (methodsToTest == null) throw new ArgumentNullException("methodsToTest"); if (entryPointAssembly == null) throw new ArgumentNullException("entryPointAssembly"); if (unitTestProviderType == UnitTestProviderType.Undefined) throw new ArgumentException("Must be defined", "unitTestProviderType"); if (numberOfBrowserHosts <= 0) throw new ArgumentOutOfRangeException("numberOfBrowserHosts", "Must be greater than 0"); //if (testAssemblyFormalNames.Count() == 0) // throw new ArgumentException("must have some assemblies specified", "testAssemblyFormalNames"); _methodsToTest = methodsToTest.ToCollection(); _tagFilters = tagFilters ?? string.Empty; UnitTestProviderType = unitTestProviderType; NumberOfBrowserHosts = numberOfBrowserHosts; WebBrowserType = webBrowserType; EntryPointAssembly = entryPointAssembly; WindowGeometry = windowGeometry; _testAssemblyFormalNames = new Collection<string>(testAssemblyFormalNames.ToList()); }
public ClientTestRunConfiguration(UnitTestProviderType unitTestProviderType, IEnumerable <string> methodsToTest, string tagFilters, int numberOfBrowserHosts, WebBrowserType webBrowserType, string entryPointAssembly, WindowGeometry windowGeometry) { if (methodsToTest == null) { throw new ArgumentNullException("methodsToTest"); } if (unitTestProviderType == UnitTestProviderType.Undefined) { throw new ArgumentException("Must be defined", "unitTestProviderType"); } if (numberOfBrowserHosts <= 0) { throw new ArgumentOutOfRangeException("numberOfBrowserHosts", "Must be greater than 0"); } _methodsToTest = methodsToTest.ToCollection(); _tagFilters = tagFilters ?? string.Empty; UnitTestProviderType = unitTestProviderType; NumberOfBrowserHosts = numberOfBrowserHosts; WebBrowserType = webBrowserType; EntryPointAssembly = entryPointAssembly; WindowGeometry = windowGeometry; }
private static List<IWebBrowser> GetWebBrowsers(ILogger logger, Uri testPageUrl, ClientTestRunConfiguration clientTestRunConfiguration, bool showTestingBrowserHost, string queryString, bool forceBrowserStart, WindowGeometry windowGeometry) { 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, windowGeometry)) .ToList(); return webBrowsers; }
public InputOptions SetWindowGeometry(WindowGeometry windowGeometry) { if (windowGeometry == null) throw new ArgumentNullException("windowGeometry"); if (windowGeometry.ShouldShowWindow && !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."); WindowGeometry = windowGeometry; return this; }
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, WindowGeometry windowGeometry) { 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, windowGeometry); var serverConfig = CreateServerConfiguration( xapPath, clientConfig.UnitTestProviderType, microsoftTestingFrameworkVersion, filesToCopyIntoHostXap, DefaultDialogSmackDownElapseMilliseconds, queryString, forceBrowserStart, showTestingBrowserHost, runtimeVersion); return new StatLightConfiguration(clientConfig, serverConfig); }