I donβt know the answer, but here is the plumbing code that worked for us with the following settings:
- TeamCity (6.0.3)
- IIS (from a fixed virtual folder)
- ASP.NET MVC3
- SeleniumDotNet v2.0.3
- Firefox driver,
- Firefox version on the server: 3.6.17
- TeamCity works as a local system (default)
Selenium setup:
public static readonly TimeSpan DefaultTimeout = TimeSpan.FromSeconds(10); private BrowserContext() {
Configure / disable firefox with SpecFlow events:
[BeforeScenario] public void BeforeWebScenario() { if (!BrowserContext.IsRunning) BrowserContext.Start(); BrowserContext.Current.Browser.NavigateTo("/Test/RecreateDatabase"); BrowserContext.Current.Browser.FindElement(By.ClassName("success-message")); } [AfterScenario] public void AfterWebScenario() { if (ScenarioContext.Current.TestError != null) { Console.WriteLine("Browser page source for failing test: {0}", BrowserContext.Current.Browser.PageSource); } bool browserPerScenario; if (bool.TryParse(ConfigurationManager.AppSettings["browserPerScenario"], out browserPerScenario) && browserPerScenario) BrowserContext.Stop(); } [AfterTestRun()] public static void StopBrowser() { if (BrowserContext.IsRunning) BrowserContext.Stop(); }
Gaspar nagy
source share