How can I make PHPUnit + Selenium run faster? How can I make PHPUnit + Selenium run faster? selenium selenium

How can I make PHPUnit + Selenium run faster?


Have you tried using the browserSessionReuse option? E.g. starting selenium with

java -jar ./selenium-server.java -browserSessionReuse


You need to share the Selenium instance between your tests. I am not familiar with PHPUnit, but in JUnit you use static member (create a base test class that holds the Selenium instance and all tests should extend it). In TestNG you can use test context.

Also try to minimize the usage of XPath if you test on IE - absence of native XPath makes tests run slower.

Also Selenium 1 uses JavaScript to drive the browser, so it is somewhat slow on IE. Selenium 2 (aka WebDriver) uses native methods to drive the browser, so at least IE tests are faster.


I'd suggest you to build Continous Integration system to run test at night. Then at morning you will have information what test are ok and what no.Check Hudson.