Skip to content

Instantly share code, notes, and snippets.

@eddiejaoude
Last active December 17, 2015 15:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eddiejaoude/5633078 to your computer and use it in GitHub Desktop.
Save eddiejaoude/5633078 to your computer and use it in GitHub Desktop.
PHPUnit & Selenium Parallel Tests

PHPUnit & Selenium Parallel Tests

https://github.com/eddiejaoude/phpunit-selenium-parallel

Options

  1. Standard grid
  • Pros: simple.
  • Cons: All tests sequential.
  1. Ant running groups in parallel (evenly split)
  • Pros: easy to setup, does not effect current setup (provided Ant is used as build too), 2 result sets.
  • Cons: tests in group run sequentially, as fast as slowest group.
  1. Parallel tests (I. /brianium/paratest )
  • Pros: runs all tests in parallel.
  • Cons: results come back separately.
  1. Parallel tests (II. /verkkokauppacom/parallel-phpunit)
  • Pros: runs all tests in parallel.
  • Cons: results come back separately.

Prerequisite

NB: From project root directory

  1. Hub: java -jar selenium-server-standalone-2.32.0.jar -role hub
  2. Slave(s): java -jar selenium-server-standalone-2.32.0.ja-role node -hub http://[HUB-IP]:4444/grid/register

Commands

tests/ directory

  1. phpunit --configuration phpunit-selenium.xml
  2. ant -f build-selenium.xml
  3. (did not work!) ../vendor/bin/paratest -p 2 -f --phpunit=/usr/bin/phpunit ApplicationTest/Selenium/
  4. ./../vendor/bin/parallel-phpunit --pu-threads 2 -c phpunit-selenium.xml ApplicationTest/Selenium/

Results

NB: 2 tests with 2 assertions, 2 worker agents

  1. 14s
  2. 8s

  3. 12s

Additional info:

Pen testing via zap proxy

Improvements

More tests should be created & run against a larger amount of selenium nodes

Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment