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(); }
public void SetUp() { var configuration = new Allors.Adapters.Object.SqlClient.Configuration { ConnectionString = ConfigurationManager.ConnectionStrings["allors"].ConnectionString, ObjectFactory = Config.ObjectFactory, CommandTimeout = 0 }; Config.Default = new Allors.Adapters.Object.SqlClient.Database(configuration); var config = new SpecsForMvcConfig(); config.UseIISExpress() .With(Project.Named("Website")) .CleanupPublishedFiles(); config.BuildRoutesUsing(RouteConfig.RegisterRoutes); //config.UseBrowser(BrowserDriver.InternetExplorer); //config.UseBrowser(BrowserDriver.Chrome); config.UseBrowser(BrowserDriver.Firefox); config.InterceptEmailMessagesOnPort(13565); this.host = new SpecsForIntegrationHost(config); // If you encounter errors then please run the following command at the command prompt // (make sure msbuild is in your path, e.g. use the Visual Studio Command Prompt) // // msbuild [SolutionName].sln /p:DeployOnBuild=true;DeployTarget=Package;_PackageTempDir="C:\github\allors\Base\Tests\bin\x64\Debug\SpecsForMvc.TempIntermediateDir using (var stringWriter = new StringWriter()) { TextWriter console = null; try { console = Console.Out; Console.SetOut(stringWriter); this.host.Start(); } catch (Exception ex) { try { if (this.host != null) { this.host.Shutdown(); } } finally { if (console != null) { Console.SetOut(console); } throw new Exception("Build failed. Output: " + stringWriter, ex); } } } }
public void SetupTestRun() { 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("MusicInstructor.Web")) //And optionally, it can apply Web.config transformations if you want //it to. .ApplyWebConfigTransformForConfig("Integration"); //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(RouteConfig.RegisterRoutes); //SpecsFor.Mvc can use either Internet Explorer or Firefox. Support //for Chrome is planned for a future release. config.UseBrowser(BrowserDriver.InternetExplorer); //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); config.Use<SeedDataConfig>(); //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(); }
public static void InitialHost(TestContext testContext) { SpecsForMvcConfig config = new SpecsForMvcConfig(); config.UseIISExpress().With(Project.Named("ParatabLib")) .CleanupPublishedFiles() .UseMSBuildExecutableAt(@"C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe") .ApplyWebConfigTransformForConfig("Debug"); config.BuildRoutesUsing(r => ParatabLib.RouteConfig.RegisterRoutes(r)); config.UseBrowser(BrowserDriver.InternetExplorer); host = new SpecsForIntegrationHost(config); host.Start(); }
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(); }
public void TestFixtureSetUp() { var config = new SpecsFor.Mvc.SpecsForMvcConfig(); config.UseIISExpress() .With(Project.Named("pear.web")) .ApplyWebConfigTransformForConfig("Debug"); config.UseBrowser(BrowserDriver.InternetExplorer); config.BuildRoutesUsing(r => RouteConfig.RegisterRoutes(r)); _integrationHost = new SpecsForIntegrationHost(config); _integrationHost.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"); 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); // 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); _host.Start(); }
public void Start() { var config = new SpecsForMvcConfig(); config.UseIISExpress() .With(Project.Named("FailTracker.Web")) .ApplyWebConfigTransformForConfig("Test"); config.BuildRoutesUsing(r => new RouteBootstrapper(r).Execute()); config.Use<TestSeedData>(); config.AuthenticateBeforeEachTestUsing<RegularUserAuthenticator>(); config.InterceptEmailMessagesOnPort(49999); _host = new SpecsForIntegrationHost(config); _host.Start(); }
public void SetupTestRun() { var config = new SpecsForMvcConfig(); config.UseIISExpress() .With(Project.Named("Xvolt.Web")); //.ApplyWebConfigTransformForConfig("Test"); config.BuildRoutesUsing(RouteConfig.RegisterRoutes); //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); _host = new SpecsForIntegrationHost(config); _host.Start(); }
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(); }