Run tests
Run the selected test or test folder: CtrlShiftF10
Stop the current test session: CtrlF2
If your tests don't require any specific actions before start, and you don't want to configure additional options, you can run them by using the following options:
Place the caret at the test class to run all tests in that class, or at the test method, and press CtrlShiftF10. Alternatively, click the
gutter icon next to the test class or test method.
The gutter icon changes depending on the state of your test:
The
gutter icon marks new tests.
The
gutter icon marks successful tests.
The
gutter icon marks failed tests.
To run all tests in a folder, select this folder in the Project tool window and press CtrlShiftF10 or select Run Tests in 'folder' from the context menu .
When you run a test, PhpStorm creates a temporary run configuration. You can save temporary run configurations, change their settings, share them with other members of your team. For more information, refer to Run/debug configurations.
Create a new run configuration or save a temporary one.
Use the configuration switcher on the main toolbar to select the configuration you want to run.
Click
or press ShiftF10.
Open the Run/Debug Configuration dialog by doing one of the following:
From the configuration switcher on the main toolbar, select Run | Edit Configurations.
Go to Run | Edit Configurations.
Press AltShiftF10 and select Edit Configuration from the context menu.
Click
on the toolbar and select the desired configuration type:
Codeception for running Codeception tests. See Codeception and Codeception.
PHPSpec for running PHPSpec specifications. See PHPSpec and PHPSpec.
Jest. See Jest and Run/Debug Configuration: Jest.
Karma. See Karma and Run/Debug Configuration: Karma.
Mocha. See Mocha and Run/Debug Configuration: Mocha.
NodeUnit for testing Node.js. See Testing Node.js and Run/Debug Configuration: NodeUnit.
note
Since May 2018, Nodeunit is deprecated. For more information, refer to the Nodeunit official website.
DartUnit for testing Dart, see Run/Debug Configuration: Dart Test.
In the dialog that opens, specify the test scope, configuration parameters, and activities to perform before test execution. Click Apply to save the changes and close the dialog.
In the Project tool window, right-click the desired test directory, individual file, or class.
From the context menu of the selection, choose Create Run configuration.
In the Run/Debug Configuration dialog that opens, specify the configuration parameters and activities to perform before test execution. Click Apply to save the changes and close the dialog.
tip
Enable the Pin Tab
option on the Run toolbar to open the results of each test run in a separate tab.
After PhpStorm finishes running your tests, it shows the results in the Run tool window on the Test Runner tab. For more information about analyzing test results, refer to Explore test results.

When you want to check that your changes wouldn't break the code before pushing them, you can do that by running tests as commit checks.
note
This feature is only available for Git and Mercurial.
After you have set up the test configuration, the specified tests will run every time you make a commit.

Use the following options on the Run toolbar of the Test Runner tab:
Click
or press CtrlF2 to terminate the process immediately.
Right-click a test on the Test Runner tab of the Run tool window and select Run 'test name'.
Click
on the Run toolbar or press CtrlF5 to rerun all tests in a session.
Click
on the Run toolbar to rerun only failed tests.
In PhpStorm, you can enable the autotest-like runner: any test in the current run configuration restarts automatically after you change the related source code.
Click
Rerun Automatically on the Run toolbar to enable the autotest-like runner.
If you don't know why a test fails, you can debug it.
In the editor, click the gutter on the line where you want to set a breakpoint.
There are different types of breakpoints that you can use depending on where you want to suspend the program. For more information, refer to Breakpoints.
Right-click the
gutter icon next to the failed test and select Debug 'test name'.
The test that has failed will be rerun in the debug mode. After that, the test will be suspended, allowing you to examine its current state.
You can step through the test to analyze its execution in detail.
Thanks for your feedback!