I hope this question is not very naive, the problem is that in Drupal 8 there are several unit tests written for modules and I want to test them. But since I am on windows os I am not able to figure out by myself how to run them.Any ideas?

  • 1
    Install Git for windows. It comes with shell. Us that to run linux commands.
    – user21641
    Jul 10, 2015 at 8:35

2 Answers 2


Drupal test runner (simpletest) has a few issues on Windows, including the inability to work with contributed database drivers (SQL Server).

As of today, exactly 3 patches are needed for this #2294731, #2748883, #2605284 (can't post the links due to not having reputation here...).

If you want to see a working example, this post explains how to run the Drupal test suite on AppVeyor that is a Windows based Continuous Integration Service.


There you will find an example cmd/powershell script with all commands needed to setup drupal and run the test suite (on windows) including commands to automatically apply the mentioned patches.


If you have a working development environment set up in Windows you should be able to download Drupal and any contributed projects that you want to test. You can also run tests without having to install the PHPUnit framework on your computer.

Run a test via Drupal UI

To run tests using the Drupal interface, enable the Testing module and go to the configuration page (admin/config/development/testing). Unfortunately as of this writing there is an active issue with running PHPUnit tests this way on Windows1. Fortunately you can also run PHPUnit tests from the command line (see below).

Run a PHPUnit test from the command line in Windows

  1. Open a command line tool (preferably Git Bash shell2)

  2. Navigate to the root of your Drupal project (the path will depend on your environment):

$ cd c:/wamp/www/myproject
  1. Run a test. The following runs a PHPUnit test belonging to the core Views module:
$ php vendor/phpunit/phpunit/phpunit -c core core/modules/views/tests/src/Unit/Plugin/argument_default/RawTest.php

The first path string points to the copy of PHPUnit that comes packaged with Drupal (Drupal also provides a symlink, but it won't work with Windows). The second path string points to the file that contains the test class. -c core tells PHPUnit to read the configuration file located in the core/ folder.

Type --verbose or --debug after the first path string to get more detailed output.

To access PHPUnit help:

$ php vendor/phpunit/phpunit/phpunit --help

1 Issue #2294731: Simpletest fails to run PHPUnit on Windows and in extracted tarballs of Drupal

2 Git Bash shell is packaged with Git for Windows


Path to PhpUnit executable has changed from core/vendor/phpunit/phpunit/phpunit to vendor/phpunit/phpunit/phpunit. (2015-10-29)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.