-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Unit_Testing
This is a first draft...feel free to elaborate.
phpMyAdmin has two types of unit tests build on PHPUnit:
- Classic unit tests
- Browser scenarios (run via Selenium RC, introduced in phpMyAdmin 3.3)
See: TestingEnvironment
tests/bootstrap.php
This file runs before starting test and contain all general code that should run before tests. You generally don't need to touch it as it does all global setup needed to run testsuite.
phpunit.xml
phpUnit configuation located in file phpunit.xml.dist,
phpunit.xml.nocoverage or phpunit.xml.hhvm. In this file located all
configuration related for automated testing
- Organization of TestSuites
- Selenium browsers configuration
- Type of logging that phpUnit needs to create
- php.ini settings, constants and globals variables
More detailed information could be found in PHPUnit official documentation.
You can run PHPUnit test from command line for whole suite.
$ cd `pma_dir>
$ ./vendor/bin/phpunit -c phpunit.xml.nocoverage
PHPUnit 3.5.13 by Sebastian Bergmann.
............................................................... 63 / 317 ( 19%)
.............SSSSS............................................. 126 / 317 ( 39%)
............................................................... 189 / 317 ( 59%)
............................................................... 252 / 317 ( 79%)
............................................................SSS 315 / 317 ( 99%)
SS
Time: 4 seconds, Memory: 28.50Mb
You can also exclude some tests groups, for example:
# Do not run selenium tests
./vendor/bin/phpunit -c phpunit.xml.nocoverage --exclude-group selenium
# Do not run tests which need network
./vendor/bin/phpunit -c phpunit.xml.nocoverage --exclude-group network
# List all available groups
./vendor/bin/phpunit -c phpunit.xml.nocoverage --list-groups
You can filter specific test to run:
./vendor/bin/phpunit -c phpunit.xml.nocoverage --filter URL
TODO: link to phpdoc ?
The following class hierarchy is used:
- PHPUnit_Framework_TestCase
- PHPUnit_Extensions_SeleniumTestCase
- PmaSeleniumTestCase
- PmaSeleniumLoginTest
- PmaSeleniumTestCase
- PmaTestCase
- PmaMessageTest
- PHPUnit_Extensions_SeleniumTestCase
Popular destinations:
- Team meetings
- GSoC home
- Developer guidelines
- How to install on Debian and Ubuntu
- Issue and pull-request management
User resources: