示例#1
0
        public void SetupTestRun()
        {
            var config = new SpecsForMvcConfig();

            config.UseIISExpress()
            .UsePort(44300)
            .UseHttps()
            .With(Project.Named("SpecsFor.Mvc.Demo"))
            .CleanupPublishedFiles()
            .ApplyWebConfigTransformForConfig("Test");

            //TODO: The order of registration matters right now, but it shouldn't.
            config.RegisterArea <TasksAreaRegistration>();
            config.BuildRoutesUsing(r => MvcApplication.RegisterRoutes(r));

            //NOTE: You can use whatever browser you want.  For build servers, you can check an environment
            //		variable to determine which browser to use, enabling you to re-run the same suite of
            //		tests once for each browser.
            //config.UseBrowser(BrowserDriver.InternetExplorer);
            config.UseBrowser(BrowserDriver.Chrome);
            //config.UseBrowser(BrowserDriver.Firefox);

            config.InterceptEmailMessagesOnPort(13565);

            config.AuthenticateBeforeEachTestUsing <StandardAuthenticator>();

            config.SetBrowserWindowSize(width: 1024, height: 768);

            _host = new SpecsForIntegrationHost(config);
            _host.Start();
        }
示例#2
0
        static public void AssemblyInit(TestContext tc)
        {
            var config = new SpecsForMvcConfig();

            //SpecsFor.Mvc can spin up an instance of IIS Express to host your app
            //while the specs are executing.
            config.UseIISExpress()
            //To do that, it needs to know the name of the project to test...
            .With(Project.Named("Bonobo.Git.Server"))
            .UsePort(20000);
            //And optionally, it can apply Web.config transformations if you want
            //it to.
            //.ApplyWebConfigTransformForConfig("Test");

            //In order to leverage the strongly-typed helpers in SpecsFor.Mvc,
            //you need to tell it about your routes.  Here we are just calling
            //the infrastructure class from our MVC app that builds the RouteTable.
            config.BuildRoutesUsing(r => Bonobo.Git.Server.App_Start.RouteConfig.RegisterRoutes(r));
            //SpecsFor.Mvc can use either Internet Explorer or Firefox.  Support
            //for Chrome is planned for a future release.
            config.UseBrowser(BrowserDriver.InternetExplorer);

            config.AuthenticateBeforeEachTestUsing <AuthHandler>();

            //Does your application send E-mails?  Well, SpecsFor.Mvc can intercept
            //those while your specifications are executing, enabling you to write
            //tests against the contents of sent messages.
            //config.InterceptEmailMessagesOnPort(13565);

            //The host takes our configuration and performs all the magic.  We
            //need to keep a reference to it so we can shut it down after all
            //the specifications have executed.
            _host = new SpecsForIntegrationHost(config);
            _host.Start();
        }
示例#3
0
        public void SetupTestRun()
        {
            var config = new SpecsForMvcConfig();
            config.UseIISExpress()
                .With(Project.Named("SpecsFor.Mvc.Demo"))
                .CleanupPublishedFiles()
                .ApplyWebConfigTransformForConfig("Test");

            //TODO: The order of registration matters right now, but it shouldn't.
            config.RegisterArea<TasksAreaRegistration>();
            config.BuildRoutesUsing(r => MvcApplication.RegisterRoutes(r));

            //NOTE: You can use whatever browser you want.  For build servers, you can check an environment
            //		variable to determine which browser to use, enabling you to re-run the same suite of
            //		tests once for each browser.
            //config.UseBrowser(BrowserDriver.InternetExplorer);
            config.UseBrowser(BrowserDriver.Chrome);
            //config.UseBrowser(BrowserDriver.Firefox);

            config.InterceptEmailMessagesOnPort(13565);

            config.AuthenticateBeforeEachTestUsing<StandardAuthenticator>();

            _host = new SpecsForIntegrationHost(config);
            _host.Start();
        }
        private void HostStart()
        {
            var config = new SpecsForMvcConfig();

            config.UseIISExpress()
            .With(Project.Named("NHibernate.AspNet.Web"))
            .CleanupPublishedFiles()
            .ApplyWebConfigTransformForConfig("Debug");

            //TODO: The order of registration matters right now, but it shouldn't.
            //config.RegisterArea<TasksAreaRegistration>();
            config.BuildRoutesUsing(r => RouteConfig.RegisterRoutes(r));

            //NOTE: You can use whatever browser you want.  For build servers, you can check an environment
            //		variable to determine which browser to use, enabling you to re-run the same suite of
            //		tests once for each browser.
            //config.UseBrowser(BrowserDriver.InternetExplorer);
            //config.UseBrowser(BrowserDriver.Chrome);
            config.UseBrowser(BrowserDriver.Firefox);

            config.InterceptEmailMessagesOnPort(13565);

            //config.AuthenticateBeforeEachTestUsing<StandardAuthenticator>();

            _host = new SpecsForIntegrationHost(config);
            _host.Start();
        }
        static public void AssemblyInit(TestContext tc)
        {
            // so we can use the resources in our test even if your language is not en-US
            Resources.Culture = new System.Globalization.CultureInfo("en-US");

            LoadedConfig = LoadConfiguration();

            var config = new SpecsForMvcConfig();

            //SpecsFor.Mvc can spin up an instance of IIS Express to host your app
            //while the specs are executing.
            config.UseIISExpress()
            //To do that, it needs to know the name of the project to test...
            .With(Project.Named("Bonobo.Git.Server"))
            .UsePort(20000)
            //And optionally, it can apply Web.config transformations if you want
            //it to.
            .ApplyWebConfigTransformForConfig("Test")
            .UseMSBuildExecutableAt(@"C:\Program Files (x86)\MSBuild\12.0\Bin\msbuild.exe");
            //.UseMSBuildExecutableAt(@"C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe");

            //In order to leverage the strongly-typed helpers in SpecsFor.Mvc,
            //you need to tell it about your routes.  Here we are just calling
            //the infrastructure class from our MVC app that builds the RouteTable.
            config.BuildRoutesUsing(r => Bonobo.Git.Server.App_Start.RouteConfig.RegisterRoutes(r));
            //SpecsFor.Mvc can use either Internet Explorer or Firefox.  Support
            //for Chrome is planned for a future release.
            config.UseBrowser(BrowserDriver.InternetExplorer);

            // We cannot use the authenticate before each step helper
            // because it is only executed once per class.
            // So if class A test1 runs, then class B test2 (this leaves us logged out)
            // then class A test2 (which assumes we are logged in). It will fail
            //config.AuthenticateBeforeEachTestUsing<AuthHandler>();

            //Does your application send E-mails?  Well, SpecsFor.Mvc can intercept
            //those while your specifications are executing, enabling you to write
            //tests against the contents of sent messages.
            //config.InterceptEmailMessagesOnPort(13565);


            // If we set a WithPublishDirectory above, then this would change
            WebApplicationDirectory = Path.Combine(Directory.GetCurrentDirectory(), "SpecsForMvc.TestSite");

            //The host takes our configuration and performs all the magic.  We
            //need to keep a reference to it so we can shut it down after all
            //the specifications have executed.
            _host = new SpecsForIntegrationHost(config);
            //try{
            _host.Start();
            //}
            //catch(Exception ex)
            //{
            //}
        }
示例#6
0
        public void Setup()
        {
            var config = new SpecsForMvcConfig();

            config.UseIISExpress()
            .ApplicationHostConfigurationFile(@"applicationhost.config")
            .With(Project.Named("WindowsAuthSampleApp"));

            config.UseBrowser(BrowserDriver.InternetExplorer);

            _host = new SpecsForIntegrationHost(config);
            _host.Start();
        }
示例#7
0
        public void Startup()
        {
            var config = new SpecsForMvcConfig();

            config.UseIISExpress().With(Project.Named("HeroicSupport.Web")).ApplyWebConfigTransformForConfig("Test");
            config.BuildRoutesUsing(RouteConfig.RegisterRoutes);
            config.UseBrowser(BrowserDriver.Chrome);
            config.AuthenticateBeforeEachTestUsing <RegularUserAuthenticator>();

            config.InterceptEmailMessagesOnPort(12345);

            config.Use <SeedDataConfig>();

            _host = new SpecsForIntegrationHost(config);
            _host.Start();
        }
示例#8
0
        public void SetupTestRun()
        {
            var config = new SpecsForMvcConfig();
            config.UseIISExpress()
                .With(Project.Named("SpecsFor.Mvc.Demo"))
                .ApplyWebConfigTransformForConfig("Test");

            config.BuildRoutesUsing(r => MvcApplication.RegisterRoutes(r));
            config.RegisterArea<TasksAreaRegistration>();

            config.UseBrowser(BrowserDriver.InternetExplorer);

            config.InterceptEmailMessagesOnPort(13565);

            config.AuthenticateBeforeEachTestUsing<StandardAuthenticator>();

            _host = new SpecsForIntegrationHost(config);
            _host.Start();
        }
        public void SetupTestRun()
        {
            var config = new SpecsForMvcConfig();

            config.UseIISExpress()
            .UsePort(44300)
            .With(Project.Named("Timesheet"))
            .CleanupPublishedFiles();

            config.BuildRoutesUsing(r => RouteConfig.RegisterRoutes(RouteTable.Routes));

            //config.UseBrowser(BrowserDriver.InternetExplorer);
            config.UseBrowser(BrowserDriver.Chrome);
            //config.UseBrowser(BrowserDriver.Firefox);

            config.SetBrowserWindowSize(width: 1024, height: 768);

            _host = new SpecsForIntegrationHost(config);
            _host.Start();
        }
示例#10
0
        public void SetupTestRun()
        {
            var config = new SpecsForMvcConfig();

            config.UseIISExpress()
            .With(Project.Named("SpecsFor.Mvc.Demo"))
            .ApplyWebConfigTransformForConfig("Test");

            config.BuildRoutesUsing(r => MvcApplication.RegisterRoutes(r));
            config.RegisterArea <TasksAreaRegistration>();

            config.UseBrowser(BrowserDriver.InternetExplorer);

            config.InterceptEmailMessagesOnPort(13565);

            config.AuthenticateBeforeEachTestUsing <StandardAuthenticator>();

            _host = new SpecsForIntegrationHost(config);
            _host.Start();
        }
示例#11
0
        public static void SetupTestRun()
        {
            if (IsRun)
            {
                return;
            }
            string msBuild = ToolLocationHelper.GetPathToBuildToolsFile("msbuild.exe", "16.0");
            var    config  = new SpecsForMvcConfig();

            config.UseIISExpress()
            .With(Project.Named("WeatherApp.FrontEnd"))
            .UseMSBuildExecutableAt(msBuild);
            config.BuildRoutesUsing(r => RouteConfig.RegisterRoutes(r));
            config.UseBrowser(BrowserDriver.InternetExplorer);
            config.PostOperationDelay(new TimeSpan(0, 0, 0, 4));
            _host = new SpecsForIntegrationHost(config);
            _host.Start();
            app = new MvcWebApp();

            IsRun = true;
        }
示例#12
0
        public static void InitializeTestRun()
        {
            var config = new SpecsForMvcConfig();

            config.UseIISExpress()
            .With(Project.Named("Demo"))
            .ApplyWebConfigTransformForConfig("Debug");

            config.BuildRoutesUsing(r => RouteConfig.RegisterRoutes(r));

            // If you want to be authenticated for each request,
            // implement IHandleAuthentication
            //config.AuthenticateBeforeEachTestUsing<SampleAuthenticator>();

            // I originally tried to use Chrome, but the Selenium
            // Chrome WebDriver, but it must be out of date because
            // Chrome gave me an error and the tests didn't run (NOTE:
            // I used the latest Selenium NuGet package as of
            // 23-08-2014). However, Firefox worked fine, so I used that.
            config.UseBrowser(BrowserDriver.Firefox);

            integrationHost = new SpecsForIntegrationHost(config);
            integrationHost.Start();
        }