Creating Run/Debug Configuration for Tests
On this page:
You can run your tests (test cases, test suites, etc.) using run/debug configurations, in the way similar to running ordinary applications. PhpStorm provides a framework for creating special run/debug configurations for testing purposes, where a test can be specified as a target.
With PhpStorm you can also create configurations for running PHP unit tests locally or on a remote server.
Creating a test configuration
To create a test configuration
- Open the Run/Debug Configuration dialog box by doing one of the following:
- On the main menu, choose .
- Press Shift+Alt+F10 and choose Edit Configuration on the context menu.
- Click on the toolbar and select the desired configuration type:
- To have unit tests executed locally, choose PHPUnit.
- For remote test execution, choose PHPUnit by HTTP.
- NodeUnit for testing Node.js. See Testing Node.js and Run/Debug Configuration: NodeUnit.
- DartUnit for testing Dart, see Run/Debug Configuration: Dart Test.
- In the dialog box that opens, specify the test scope, configuration parameters, and activities to perform before test execution. Apply the changes and close the dialog box.
Creating a test configuration for a specific target
To create a test configuration for a specific target
- In the Project tool window, right-click the desired test directory, individual file, or class.
- On the context menu of the selection, choose Create Run configuration. PhpStorm displays a list of suggested configurations. Each configuration has the name of the selected target and is supplied with an icon indicating its type.
- - the icon marks a PHPUnit configuration for running tests locally.
- - the icon marks a PHPUnit by HTTP configuration for running tests remotely.
- In the Run/Debug Configuration dialog box that opens, specify the configuration parameters and activities to perform before test execution. Apply the changes and close the dialog box.