Why is my unit test not detected? I have a custom Drupal 8 module for which I'm trying to create unit tests by following the instructions at https://www.drupal.org/phpunit.

The path of my module is: /modules/custom/dev_module
The path of my tests is: /modules/custom/dev_module/tests/src/Unit

More specifically, in the Unit folder I have a DummyTest.php file with the following code:

&lt;?php

namespace Drupal\dev_module\Tests;

use Drupal\Tests\UnitTestCase;

/**
 * My dummy test.
 *
 * @group dummy_test
 */
class DummyTest extends UnitTestCase {

  public function testDummy() {
    $this-&gt;assertEquals(5, 5);
  }

}


When executing the following commands from the terminal (I'm on Mac OS):

 &gt; cd core
 &gt; ../vendor/bin/phpunit --list-groups


My group dummy_test doesn't show up in the listed groups. Any idea why?
Unit tests must have the following namespace: Drupal\Tests\dev_module\Unit.

For complicated reasons, they also don't show up in the right group but they are all in the PHPUnit group.

To run your unit tests with phpunit, just pass the module folder, that also makes it 10x faster for finding the tests:

./vendor/bin/phpunit -c core modules/dev_module