tags:

views:

1345

answers:

2

By design, Selenium makes a new copy of your Firefox profile each time a new test is run. I find this copy time is a considerable bottleneck, especially when running 100s of tests. (5-15 seconds to copy the profile anew).

Does anyone know of any override behavior for this? I'd prefer my Selenium server to just reuse the same firefox profile. I know this violates the "cleanly set up your test fixtures" philosophy, but it's a shortcut I'm willing to take, as my tests don't materially alter my firefox profile enough to jeopardize future tests.

+3  A: 

It's simply a matter of moving the code below outside of your test setup and into the fixture setup and keeping a global of the selenium instance (code assumes NUnit.)

[TestFixtureSetUp()]
public void FixtureSetup()
{
    selenium = New DefaultSelenium("localhost", 4444, "*firefox", "http://localhost/");
    selenium.Start();
    selenium.SetTimeout("30000");
    selenium.Open("/");
}

Your test setup should then look something like this:

[SetUp()]
public void SetUpTest()
{
    selenium.Open("default.aspx");
    selenium.WaitForPageToLoad("30000");
}
Gavin Miller
+3  A: 

I agree this is a problem. It's nice to have a new copy of a Firefox process each time, but a bit overkill to double the startup time by regenerating the Firefox profile. If you open a bug report on http://jira.openqa.org and email me at [email protected] I'll be happy to make sure we get a solution in place.

PS: I've solved this problem as a one-off for myself. We use the same Firefox profile and just nuke out the cache and cookies DB. But I really should just patch that change back to the Selenium source.

Patrick Lightbody