Types of tests

Body

This documentation needs work. See "Help improve this page" in the sidebar.

 

PHPUnit

Most testing in current versions of Drupal is done under the PHPUnit framework. Drupal supports unit, integration, and system/functional testing using the PHPUnit framework.

In Drupal, there are 4 types of PHPUnit tests.

Unit

PHPUnit-based tests with minimal dependencies.

Base class: Drupal\Tests\UnitTestCase class.

Kernel

PHPUnit-based tests with a bootstrapped kernel, and a minimal number of extensions enabled.

Base class: Drupal\KernelTests\KernelTestBase class.

Functional

PHPUnit-based tests with a full booted Drupal instance.

Base class: Drupal\Tests\BrowserTestBase.

FunctionalJavascript

PHPUnit-based tests that use Webdriver to perform tests of Javascript and Ajax functionality in the browser.

There is a base class for general testing, Drupal\FunctionalJavascriptTests\WebDriverTestBase, and one for performance testing, Drupal\FunctionalJavascriptTests\PerformanceTestBase.

Nightwatch

Drupal project uses the Nightwatch framework for JavaScript testing. See JavaScript testing using Nightwatch.

Knowledge Category