Пример #1
0
        private void RunApplicationBase(TestApplication testApplication)
        {
            var url = testApplication.ParameterValue <string>(ApplicationParams.Url);
            var uri = new Uri(url);

            webBrowsers = CreateWebBrowsers(testApplication);
            var physicalPath = testApplication.ParameterValue <string>(ApplicationParams.PhysicalPath);

            if (string.IsNullOrEmpty(physicalPath) && !testApplication.ParameterValue <bool>(ApplicationParams.DontRestartIIS))
            {
                RestartIIS();
            }
            else
            {
                if (!testApplication.ParameterValue <bool>(ApplicationParams.DontRunWebDev) && !string.IsNullOrEmpty(physicalPath))
                {
                    typeof(DevExpress.ExpressApp.EasyTest.WebAdapter.WebAdapter).CallMethod("LoadFileInfo", Path.GetFullPath(physicalPath));
                    if (testApplication.ParameterValue <string>(ApplicationParams.SingleWebDev) == null)
                    {
                        if (WebDevWebServerHelper.IsWebDevServerStarted(uri))
                        {
                            WebDevWebServerHelper.KillWebDevWebServer();
                        }
                        WebDevWebServerHelper.RunWebDevWebServer(Path.GetFullPath(physicalPath), uri.Port.ToString(CultureInfo.InvariantCulture));
                    }
                    else
                    {
                        if (!WebDevWebServerHelper.IsWebDevServerStarted(uri))
                        {
                            WebDevWebServerHelper.RunWebDevWebServer(Path.GetFullPath(physicalPath), uri.Port.ToString(CultureInfo.InvariantCulture));
                        }
                    }
                }
            }
            var defaultWindowSize = testApplication.ParameterValue <string>(ApplicationParams.DefaultWindowSize);

            if (defaultWindowSize != null)
            {
                WebBrowserCollection.DefaultFormSize = GetWindowSize(defaultWindowSize);
            }
            var waitDebuggerAttached = testApplication.ParameterValue <bool>(ApplicationParams.WaitDebuggerAttached);

            if (waitDebuggerAttached)
            {
                Thread.Sleep(8000);
                if (Debugger.IsAttached)
                {
                    MessageBox.Show("Start web application?", "Warning", MessageBoxButtons.OK);
                }
            }
            DateTime current = DateTime.Now;

            while (!WebDevWebServerHelper.IsWebDevServerStarted(uri) && DateTime.Now.Subtract(current).TotalSeconds < 60)
            {
                Thread.Sleep(200);
            }
            this.CreateBrowser(url);
        }
Пример #2
0
        public override void RunApplication(TestApplication testApplication)
        {
            if (!GetParamValue("UseIISExpress", false, testApplication))
            {
                base.RunApplication(testApplication);
            }
            else
            {
                string url            = testApplication.GetParamValue(UrlParamName);
                var    uri            = new Uri(url);
                string webBrowserType = testApplication.FindParamValue("WebBrowserType");
                webBrowsers = string.IsNullOrEmpty(webBrowserType) ? (IWebBrowserCollection) new WebBrowserCollection() : new StandaloneWebBrowserCollection();

                if (!WebDevWebServerHelper.IsWebDevServerStarted(uri))
                {
                    IISExpressServerHelper.Run(testApplication, uri);
                }
                if (testApplication.FindParamValue("DefaultWindowSize") != null)
                {
                    WebBrowserCollection.DefaultFormSize = GetWindowSize(testApplication.GetParamValue("DefaultWindowSize"));
                }
                this.CallMethod("CreateBrowser", url);
            }
        }
Пример #3
0
        private void RunApplicationCore(TestApplication testApplication)
        {
            var defaultWindowSize = testApplication.ParameterValue <string>(ApplicationParams.DefaultWindowSize);

            if (defaultWindowSize != null)
            {
                WebBrowserCollection.DefaultFormSize = GetWindowSize(defaultWindowSize);
            }
            if (!testApplication.ParameterValue <bool>(ApplicationParams.UseIISExpress))
            {
                RunApplicationBase(testApplication);
            }
            else
            {
                var url = testApplication.ParameterValue <string>(ApplicationParams.Url);
                var uri = new Uri(url);
                webBrowsers = CreateWebBrowsers(testApplication);
                if (!WebDevWebServerHelper.IsWebDevServerStarted(uri))
                {
                    _process = IISExpressServerHelper.Run(testApplication, uri);
                }
                this.CreateBrowser(url);
            }
        }