How to avoid additional HTTP request at the beginning of testing?

Let's say I have a test like this:

class SortTest extends PHPUnit_Extensions_Selenium2TestCase { public function setUp() { $this->setHost('192.168.1.1'); $this->setBrowserUrl('http://some.url/'); $this->setBrowser('chrome'); } public function testFoo() { $this->url('/foo'); } public function testBar() { $this->url('/bar'); } } 

If I run this test, I will see that every time the root page loads, then the required /foo or /bar opens.

If I comment or redirect the setBrowserUrl() call to the test method, I get an Undefined index: browserUrl

So, is there a way to avoid redundant HTTP request in the testing method?

+4
source share
1 answer

So, is there a way to avoid redundant HTTP request by test method

By setting the browser URL to the empty string $this->setBrowserUrl(''); but then it requires that any other url be absolute $this->url('http://some.url/foo'); This will not stop Selena from trying to access empty URLs, but it will do it much faster, especially if the start page is hard

+2
source

All Articles