Generally, PhpStorm runs and debugs tests in the same way as other applications, by running the run/debug configurations you have created. When doing so, it passes the specified test classes or methods to the test runner.
In many cases, you can initiate a testing session from a context menu. For this purpose, the Run and Debug commands are provided in certain context menus. For example, these commands are available for a test class, directory, or a package in the Project tool window. They are also available for a test class or method you are currently working with in the editor.
If you run a test for which there is no permanent run/debug configuration, a temporary configuration is created. You can then save such a configuration if you want to keep it.
The tests run in the background, so you can execute several tests at the same time.
To start running or debugging a test, you can use the main toolbar, or a context menu in the Project tool window or in the editor:
Using the main toolbar:
Select the necessary run/debug configuration from the list on the main toolbar.
- Click Run or Debug to the right of the list. (Alternatively, choose Run | Run (Shift+F10Shift+F10Shift+F10Shift+F10Shift+F10Ctrl+F5F6Shift+Alt+X or Shift+F10Control RControl RShift Command F11) or Run | Debug (Shift+F9Shift+F9Shift+F9Shift+F9Shift+F9Alt+F5Ctrl+F5Shift+Alt+D or Shift+F9Control DControl DCommand F11) from the main menu.)
To see the list of available run or debug configurations and to quickly select the one you want, you can use the following keyboard shortcuts: Shift+Alt+F10Shift+Alt+F10Shift+Alt+F10Shift+Alt+F10Shift+Alt+F10Shift+Alt+F10Shift+Alt+F10Shift+Alt+F10Control Alt RControl Alt RControl Alt R for the run configurations, or Shift+Alt+F9Shift+Alt+F9Shift+Alt+F9Shift+Alt+F9Shift+Alt+F9Shift+Alt+F9Shift+Alt+F9Shift+Alt+F9Control Alt DControl Alt DControl Alt D for the debug configurations.
- Select the necessary run/debug configuration from the list on the main toolbar.
Using a context menu:
Right-click a test file or test class in the Project tool window, or open it in the editor, and right-click the background. On the context menu, choose Run < class name> / Run < file name> or Debug....
For a test method, open the class in the editor and right click anywhere in the method. The context menu suggests the command Run / Debug <method name>.