Types of Testing

There are 4 major categories of testing available out-of-box Drupal core. These tests focus on different aspects of code and functionality. Some part of the code could have tests on multiple types.

All these types are heavily based generic PHP libraries: PHPUnit, MinkPHP and Guzzle. Basic knowledge on those would help a lot.

Note: There are still some legacy simpletest module based tests are available in core (most of them based on WebTestBase). Do not use them as the plan is to migrate to PHPUnit.

Types

1. Unit

Basic tests without bootstrap/create Drupal site. Function/method level testing

2. Kernel

Kernel test allows to do integration testing which helps to setup dependency injection container. Also allows to bootstrap/load required drupal elements like entity schema and module schemas.

3. Functional

Checks behaviour of an application as an user. This would allow to test end-to-end functionality.

Note:
When assert, labels, Button text, messages are not translated (i.e. passed in t()) as these tests are running in single language instance. Check here for more details.

4. Functional Javascript

Structure

Class

Directory

Reference

  1. UnitTestCase
  2. KernelTestBase
  3. BrowserTestBase
  4. JavaScriptTestBase

results matching ""

    No results matching ""