Creating Run/Debug Configuration for Tests
You can run your tests (test cases, test suites, and so on) 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.
In addition to the regular test configuration creation, PhpStorm supports creating test configurations for specific targets, for example for all tests in a file, class, or directory, or for an arbitrary selection of test classes and methods.
To create a test configuration
-
Open the Run/Debug Configuration dialog by doing one of the following:
On the main menu, choose
.Press Shift+Alt+F10 and select Edit Configuration from the context menu.
- Click on the toolbar and select the desired configuration type:
PHPUnit for running PHPUnit tests.
Behat for running Behat tests.
Codeception for running Codeception tests.
PHPSpec for running PHPSpec specifications.
JSTestDriver for testing JavaScript using JSTestDriver. See JSTestDriver and Run/Debug Configuration: JSTestDriver.
Karma for testing JavaScript using JSTestDriver. See Karma and Run/Debug Configuration: Karma.
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 that opens, specify the test scope, configuration parameters, and activities to perform before test execution. Apply the changes and close the dialog
To create a test configuration for a specific target
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. Apply the changes and close the dialog.