{"id":16078311,"url":"https://github.com/sandrokeil/docker-selenium-grid-phpunit","last_synced_at":"2025-03-18T05:31:26.496Z","repository":{"id":74519473,"uuid":"59503802","full_name":"sandrokeil/docker-selenium-grid-phpunit","owner":"sandrokeil","description":"An example how to use a Selenium-Grid with Docker and PHPUnit/Mink","archived":false,"fork":false,"pushed_at":"2016-07-07T20:52:59.000Z","size":14,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-28T07:35:00.733Z","etag":null,"topics":["docker","mink","parallel","paratest","phpunit","selenium","selenium-grid","selenium-node","selenium-server"],"latest_commit_sha":null,"homepage":"https://sandro-keil.de/blog/2015/03/23/selenium-grid-in-minutes-with-docker/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sandrokeil.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-05-23T17:24:51.000Z","updated_at":"2023-06-03T22:03:30.000Z","dependencies_parsed_at":"2023-03-20T22:03:33.635Z","dependency_job_id":null,"html_url":"https://github.com/sandrokeil/docker-selenium-grid-phpunit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandrokeil%2Fdocker-selenium-grid-phpunit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandrokeil%2Fdocker-selenium-grid-phpunit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandrokeil%2Fdocker-selenium-grid-phpunit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandrokeil%2Fdocker-selenium-grid-phpunit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sandrokeil","download_url":"https://codeload.github.com/sandrokeil/docker-selenium-grid-phpunit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243903182,"owners_count":20366438,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","mink","parallel","paratest","phpunit","selenium","selenium-grid","selenium-node","selenium-server"],"created_at":"2024-10-09T10:11:39.685Z","updated_at":"2025-03-18T05:31:26.489Z","avatar_url":"https://github.com/sandrokeil.png","language":"PHP","readme":"# Docker Selenium-Grid PHPUnit/Mink\n\n\u003e This is the example application for the article [Selenium-Grid mit Docker im PHP Magazin 5.16](https://entwickler.de/php-magazin/php-magazin-5-16-252647.html \"Parallele Akzeptanztests in wenigen Minuten\")\n\nThis is a simple example how to use a [Selenium-Grid](https://github.com/SeleniumHQ/selenium/wiki/Grid2) \nwith [PHPUnit](https://phpunit.de/) and [Mink](http://mink.behat.org/en/latest/). There are three test classes, to \ndemonstrate parallel execution of tests. One test has a duration of ~10s (uses `sleep()`). So you\ncan see the difference and have time to observe the test execution in the Selenium-Grid.\n\n* `WikipediaChromeTest`: Uses Google Chrome with Selenium to test the search widget\n* `WikipediaFirefoxTest`: Uses Mozilla Firefox with Selenium to test the search widget\n* `WikipediaGoutteTest`: Uses Mink Goutte Driver to test the search widget (headless Browser)\n\n## Start Selenium-Grid\nFirst, you need to setup a Selenium-Grid. Please install [Docker \u003e= 1.11](https://docs.docker.com/engine/installation/linux/ubuntulinux/) \nand [Docker Compose \u003e= 1.7](https://docs.docker.com/compose/install/) and then run:\n\n```\n$ docker-compose up -d\n```\n\nIf you interested in more Docker Images, please take a look at the [prooph/docker-files](https://github.com/prooph/docker-files).\n\n### Scaling Selenium-Grid\nYou can run more Firefox oder Chrome instances by running:\n\n```\n$ docker-compose scale firefox=5\n$ docker-compose scale chrome=5\n```\n\n### Watching Tests\nYou can watch the test execution with a VNC Viewer like [xvnc4viewer](https://wiki.ubuntuusers.de/VNC/#Kommandozeile).\n\nDetermine the ports of the Selenium-Node Docker container with:\n\n```\n$ docker-compose port firefox\n$ docker-compose port chrome\n```\n\nUse the IP/Port with the VNC Viewer. The passwort is *secret*:\n\n```\n$ vncviewer 0.0.0.0:49338\n```\n\n## Install Composer Dependencies\nTo install the [Composer](https://getcomposer.org/) dependencies run:\n\n```\n$ docker run --rm -it --volume $(pwd):/app prooph/composer:7.0 install --dev -o\n```\n\n## Using PHPUnit\nEvery test is executed in order. This should take ~28s.\n\n```\n$ docker run --rm -it --volume $(pwd):/app --link hub:hub prooph/php:7.0-cli vendor/bin/phpunit\n```\n\nOutput:\n\n```bash\nPHPUnit 5.3.4 by Sebastian Bergmann and contributors.\n\n...                                                                 3 / 3 (100%)\n\nTime: 28.07 seconds, Memory: 8.00MB\n\nOK (3 tests, 3 assertions)\n```\n\n## Using ParaTest\nThe objective of [ParaTest](https://github.com/brianium/paratest) is to support parallel testing in PHPUnit.\nEvery test is executed in parallel. This should take ~13s.\n\n```\n$ docker run --rm -it --volume $(pwd):/app --link hub:hub prooph/php:7.0-cli vendor/bin/paratest\n```\n\nOutput:\n\n```bash\nRunning phpunit in 5 processes with /app/vendor/bin/phpunit\n\nConfiguration read from /app/phpunit.xml.dist\n\n...\n\nTime: 13.57 seconds, Memory: 4.00MB\n\nOK (3 tests, 3 assertions)\n```\n\n## Using parallel\nEvery test is executed [parallel](https://launchpad.net/ubuntu/+source/parallel) in an own Docker PHP container. \nThis should take ~13s.\n\n```\n$ find test/ -name \"*Test.php\" | parallel --gnu -P 0 'docker run --rm --volume $(pwd):/app --link hub:hub prooph/php:7.0-cli vendor/bin/phpunit {};echo \"Runned {} tests\";'\n```\n\nOutput:\n```bash\nWhen using programs that use GNU Parallel to process data for publication please cite:\n\n  O. Tange (2011): GNU Parallel - The Command-Line Power Tool,\n  ;login: The USENIX Magazine, February 2011:42-47.\n\nThis helps funding further development; and it won't cost you a cent.\nOr you can get GNU Parallel without this requirement by paying 10000 EUR.\n\nTo silence this citation notice run 'parallel --bibtex' once or use '--no-notice'.\n\nPHPUnit 5.3.4 by Sebastian Bergmann and contributors.\n\n.                                                                   1 / 1 (100%)\n\nTime: 5.73 seconds, Memory: 6.00MB\n\nOK (1 test, 1 assertion)\nRunned test/integration/WikipediaGoutteTest.php tests\nPHPUnit 5.3.4 by Sebastian Bergmann and contributors.\n\n.                                                                   1 / 1 (100%)\n\nTime: 9.44 seconds, Memory: 4.00MB\n\nOK (1 test, 1 assertion)\nRunned test/integration/WikipediaChromeTest.php tests\nPHPUnit 5.3.4 by Sebastian Bergmann and contributors.\n\n.                                                                   1 / 1 (100%)\n\nTime: 13.14 seconds, Memory: 6.00MB\n\nOK (1 test, 1 assertion)\nRunned test/integration/WikipediaFirefoxTest.php tests\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsandrokeil%2Fdocker-selenium-grid-phpunit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsandrokeil%2Fdocker-selenium-grid-phpunit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsandrokeil%2Fdocker-selenium-grid-phpunit/lists"}