Slow acceptance testing with php + codeception + phantomjs

I move on to code 2.0.3 to run some tests on various web platforms that I am developing. I started doing acceptance tests. Basically check for page availability and do some form additions (login, register, don't think of anything).

I am tracking tests using Firefox browser and we are now moving to dedicated server testing, so I switched to phantomjs as my testing browser.

Config in accept.suite.yml

WebDriver:
  url: 'localUrl'
  browser: phantomjs 
  window_size: 'maximize'
  capabilities:
      phantomjs.cli.args: ['--ignore-ssl-errors=true']

      

The point is that with this headless configuration, tests are very slow to run. I mean, the test I wrote verifies that four links are ok (error or exception message) without any fancy assertions (something I can test in less than 20 seconds), and this takes more than a minute and a half.

Am I missing something in the test stack configuration? I've read that testing phantomjs in this way is destined to be fast and reliable, something that can be integrated during development, but I don't seem to believe it works correctly. I'm doing TDD in Smalltalk and maybe I'm a little inclined to have everything work in this environment, so maybe my expectations are too high, but I was hoping this could be a little more responsive and lightweight.

I am using code 2.0.3 with phantomjs 1.9.7 on linux box with php 5.5.

Any suggestion is greatly appreciated. Thank!!!

+3


source to share


3 answers


I was having very slow tests and started using strict locators. It sped up a lot.

Instead of writing:

$I->fillField('username, 'john');

      

which will try and not remove many types of locators before actually working, specify the locator you are using and write:

$I->fillField(['id' => 'username'], 'john');

      



or

$I->fillField(['class' => 'username'], 'john');

      

or

$I->fillField(['css' => 'input .username'], 'john');

      

Read here: http://codeception.com/docs/04-AcceptanceTests#Click

+2


source


There may be a problem with phantomjs, usually no headgear with Codeception PhpBrowser goes very fast, try switching to it.

In the browser, try using Codeception WebDriver + latest selenium 2 separately.



Also, if you are working with any framework, you can check if it is in the list of Codeception modules. If you can use it, it is much faster than PhpBrowser since no server needs it and works with symfony dom-crawler and a bunch of browsers.

+1


source


Also the size of the sql file of the database matters. In my case, importing some large tables took over a minute of extra time.

0


source







All Articles