|`E2E` |`e2e`|Agnostic|`CiviEndToEndTestCase`|Useful for command-line scripts and web-services|
|`WebTest`|`e2e`|Drupal|`CiviSeleniumTestCase`|Useful for tests which require a full web-browser|
!!! tip
If you are using PhpStorm, you can [run the tests from within PhpStorm](/tools/phpstorm.md#testing)(which is especially helpful because you can set breakpoints and inspect variables while the tests run).
Each extension may have its own suite(s).
## Running Tests
## Running tests
From the CiviCRM root directory run the phpunit command, specifying a single
test if necessary.
To execute all tests in a suite, run the corresponding `AllTests.php` file. For example, this command runs the full `CRM` suite:
You can also specify tests in an environment variable `PHPUNIT_TESTS` (eg. `env PHPUNIT_TESTS="MyFirstTest::testFoo MySecondTest" phpunit EnvTests`
Then run `phpunit4 ./tests/phpunit/EnvTests.php`.
Generally, note how each example breaks down into a few pieces of information. These
are the elements you would need to run PHPUnit tests in `civicrm-core`, but the formula
would be the same for an extension:
* Path to codebase. (Ex: `/path/to/civicrm`)
* If required, any environment variables. (For `headless` tests, use `CIVICRM_UF=UnitTests`)
* Name of the PHPUnit command. (Ex: `phpunit4`, which is bundled with [buildkit](/tools/buildkit.md))
* Name of the test file. (Ex: `tests/phpunit/CRM/Core/RegionTest.php` or `tests/phpunit/CRM/AllTests.php`)
!!! tip "PhpStorm"
PhpStorm is an IDE which provides built-in support for executing tests with a debugger -- you can set breakpoints and inspect variables while the tests run.
Once you've successfully run a test on the command-line, you can take it to the next level and [run the tests within PhpStorm](/tools/phpstorm.md#testing).
!!! tip "civi-test-run"
[civi-test-run](/tools/civi-test-run.md) is a grand unified wrapper which runs *all* CiviCRM test suites. It's particularly useful for *continuous-integration*.
!!! tip "Select tests using `--filter`, `--group`, etc"
The PHPUnit CLI supports a number of [filtering options](https://phpunit.de/manual/current/en/textui.html). For example,
execute a single test function, you can pass `--filter`, as in: