Adopt consistent naming standards for multiple test @groups

Created on 28 March 2017, over 8 years ago
Updated 27 May 2025, about 1 month ago

Problem/Motivation

This issue might need to be moved to a policy project, but I'm not sure which one.

KernelTestBaseTest looks like this:

/**
 * @coversDefaultClass \Drupal\KernelTests\KernelTestBase
 * @group PHPUnit
 */
class KernelTestBaseTest extends KernelTestBase {

BrowserTestBaseTest looks like this:

/**
 * Tests BrowserTestBase functionality.
 *
 * @coversDefaultClass \Drupal\Tests\BrowserTestBase
 * @group browsertestbase
 */
class BrowserTestBaseTest extends BrowserTestBase {

The sharp-eyed among you will notice that they have different groups, and neither group satisfies the semi-formal standards we have for @group annotations: #2297541: Secondary/additional test @group names β†’

Furthermore it means that we can't just run tests about tests using @group annotations.

The semi-formal standard is that the first @group annotation should be either the module name or a 'component,' which in practice means the last part of the namespace of the thing being tested.

There are probably other examples of tests which aren't annotated very well.

A glance over the output of $ ./vendor/bin/phpunit -c core/ --list-groups shows that browsertestbase and PHPUnit really do stick out as out-of-place, so maybe it's not as bad as it seems.

Proposed resolution

  • Come up with useful categories which might also fit our annotation standard, such as @group testing, so that a dev can run all tests relating to tests.
  • Fix annotations depending on the decisions above. This could include secondary annotations.

Remaining tasks

Make group annotations more usable: #2296615: Accurately support multiple @groups per test class β†’

User interface changes

API changes

Data model changes

πŸ“Œ Task
Status

Closed: duplicate

Version

11.0 πŸ”₯

Component

phpunit

Created by

πŸ‡ΊπŸ‡ΈUnited States mile23 Seattle, WA

Live updates comments and jobs are added and updated live.
  • Coding standards

    It involves compliance with, or the content of coding standards. Requires broad community agreement.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024