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?
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
Open a command line tool (preferably Git Bash shell2)
Navigate to the root of your Drupal project (the path will depend on your environment):
$ cd c:/wamp/www/myproject
- 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
--debug after the first path string to get more detailed output.
To access PHPUnit help:
$ php vendor/phpunit/phpunit/phpunit --help
2 Git Bash shell is packaged with Git for Windows
Path to PhpUnit executable has changed from