Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 62f66f5

Browse files
github-actions[bot]github-actions[bot]
authored andcommittedMay 28, 2025·
updated
1 parent e3efa01 commit 62f66f5

File tree

1 file changed

+181
-181
lines changed

1 file changed

+181
-181
lines changed
 

‎docs/reference/Commands.md

Lines changed: 181 additions & 181 deletions
Original file line numberDiff line numberDiff line change
@@ -5,116 +5,166 @@ title: Commands - Codeception - Documentation
55

66
# Console Commands
77

8-
## DryRun
8+
## CompletionFallback
99

10-
Shows step-by-step execution process for scenario driven tests without actually running them.
1110

12-
* `codecept dry-run acceptance`
13-
* `codecept dry-run acceptance MyCest`
14-
* `codecept dry-run acceptance checkout.feature`
15-
* `codecept dry-run tests/acceptance/MyCest.php`
1611

12+
## Run
1713

14+
Executes tests.
1815

16+
Usage:
1917

20-
## Build
18+
* `codecept run acceptance`: run all acceptance tests
19+
* `codecept run tests/acceptance/MyCest.php`: run only MyCest
20+
* `codecept run acceptance MyCest`: same as above
21+
* `codecept run acceptance MyCest:myTestInIt`: run one test from a Cest
22+
* `codecept run acceptance MyCest:myTestInIt#1`: run one example or data provider item by number
23+
* `codecept run acceptance MyCest:myTestInIt#1-3`: run a range of examples or data provider items
24+
* `codecept run acceptance MyCest:myTestInIt@name.*`: run data provider items with matching names
25+
* `codecept run acceptance checkout.feature`: run feature-file
26+
* `codecept run acceptance -g slow`: run tests from *slow* group
27+
* `codecept run unit,functional`: run only unit and functional suites
2128

22-
Generates Actor classes (initially Guy classes) from suite configs.
23-
Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
29+
Verbosity modes:
2430

25-
* `codecept build`
26-
* `codecept build path/to/project`
31+
* `codecept run -v`:
32+
* `codecept run --steps`: print step-by-step execution
33+
* `codecept run -vv`: print steps and debug information
34+
* `codecept run --debug`: alias for `-vv`
35+
* `codecept run -vvv`: print Codeception-internal debug information
2736

37+
Load config:
2838

39+
* `codecept run -c path/to/another/config`: from another dir
40+
* `codecept run -c another_config.yml`: from another config file
2941

42+
Override config values:
3043

31-
## GenerateScenarios
44+
* `codecept run -o "settings: shuffle: true"`: enable shuffle
45+
* `codecept run -o "settings: lint: false"`: disable linting
3246

33-
Generates user-friendly text scenarios from scenario-driven tests (Cest).
47+
Run with specific extension
3448

35-
* `codecept g:scenarios acceptance` - for all acceptance tests
36-
* `codecept g:scenarios acceptance --format html` - in html format
37-
* `codecept g:scenarios acceptance --path doc` - generate scenarios to `doc` dir
49+
* `codecept run --ext Recorder` run with Recorder extension enabled
50+
* `codecept run --ext DotReporter` run with DotReporter printer
51+
* `codecept run --ext "My\Custom\Extension"` run with an extension loaded by class name
3852

53+
Full reference:
54+
{% highlight yaml %}
55+
Arguments:
56+
suite suite to be tested
57+
test test to be run
3958

59+
Options:
60+
-o, --override=OVERRIDE Override config values (multiple values allowed)
61+
--config (-c) Use custom path for config
62+
--report Show output in compact style
63+
--html Generate html with results (default: "report.html")
64+
--xml Generate JUnit XML Log (default: "report.xml")
65+
--phpunit-xml Generate PhpUnit XML Log (default: "phpunit-report.xml")
66+
--no-redirect Do not redirect to Composer-installed version in vendor/codeception
67+
--colors Use colors in output
68+
--no-colors Force no colors in output (useful to override config file)
69+
--silent Only outputs suite names and final results. Almost the same as `--quiet`
70+
--steps Show steps in output
71+
--debug (-d) Alias for `-vv`
72+
--bootstrap Execute bootstrap script before the test
73+
--coverage Run with code coverage (default: "coverage.serialized")
74+
--disable-coverage-php Don't generate CodeCoverage report in raw PHP serialized format
75+
--coverage-html Generate CodeCoverage HTML report in path (default: "coverage")
76+
--coverage-xml Generate CodeCoverage XML report in file (default: "coverage.xml")
77+
--coverage-text Generate CodeCoverage text report in file (default: "coverage.txt")
78+
--coverage-phpunit Generate CodeCoverage PHPUnit report in file (default: "coverage-phpunit")
79+
--coverage-cobertura Generate CodeCoverage Cobertura report in file (default: "coverage-cobertura")
80+
--no-exit Don't finish with exit code
81+
--group (-g) Groups of tests to be executed (multiple values allowed)
82+
--skip (-s) Skip selected suites (multiple values allowed)
83+
--skip-group (-x) Skip selected groups (multiple values allowed)
84+
--env Run tests in selected environments. (multiple values allowed, environments can be merged with ',')
85+
--fail-fast (-f) Stop after nth failure (defaults to 1)
86+
--no-rebuild Do not rebuild actor classes on start
87+
--help (-h) Display this help message.
88+
--quiet (-q) Do not output any message. Almost the same as `--silent`
89+
--verbose (-v|vv|vvv) Increase the verbosity of messages: `v` for normal output, `vv` for steps and debug, `vvv` for Codeception-internal debug
90+
--version (-V) Display this application version.
91+
--ansi Force ANSI output.
92+
--no-ansi Disable ANSI output.
93+
--no-interaction (-n) Do not ask any interactive question.
94+
--seed Use the given seed for shuffling tests
4095

96+
{% endhighlight %}
4197

42-
## ConfigValidate
4398

44-
Validates and prints Codeception config.
45-
Use it do debug Yaml configs
4699

47-
Check config:
48-
49-
* `codecept config`: check global config
50-
* `codecept config unit`: check suite config
51100

52-
Load config:
101+
## GenerateEnvironment
53102

54-
* `codecept config:validate -c path/to/another/config`: from another dir
55-
* `codecept config:validate -c another_config.yml`: from another config file
103+
Generates empty environment configuration file into envs dir:
56104

57-
Check overriding config values (like in `run` command)
105+
* `codecept g:env firefox`
58106

59-
* `codecept config:validate -o "settings: shuffle: true"`: enable shuffle
60-
* `codecept config:validate -o "settings: lint: false"`: disable linting
61-
* `codecept config:validate -o "reporters: report: \Custom\Reporter" --report`: use custom reporter
107+
Required to have `envs` path to be specified in `codeception.yml`
62108

63109

64110

111+
## GherkinSnippets
65112

66-
## GenerateFeature
113+
Generates code snippets for matched feature files in a suite.
114+
Code snippets are expected to be implemented in Actor or PageObjects
67115

68-
Generates Feature file (in Gherkin):
116+
Usage:
69117

70-
* `codecept generate:feature suite Login`
71-
* `codecept g:feature suite subdir/subdir/login.feature`
72-
* `codecept g:feature suite login.feature -c path/to/project`
118+
* `codecept gherkin:snippets acceptance` - snippets from all feature of acceptance tests
119+
* `codecept gherkin:snippets acceptance/feature/users` - snippets from `feature/users` dir of acceptance tests
120+
* `codecept gherkin:snippets acceptance user_account.feature` - snippets from a single feature file
121+
* `codecept gherkin:snippets acceptance/feature/users/user_accout.feature` - snippets from feature file in a dir
73122

74123

75124

125+
## Build
76126

77-
## GherkinSteps
127+
Generates Actor classes (initially Guy classes) from suite configs.
128+
Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
78129

79-
Prints all steps from all Gherkin contexts for a specific suite
130+
* `codecept build`
131+
* `codecept build path/to/project`
80132

81-
{% highlight yaml %}
82-
codecept gherkin:steps acceptance
83133

84-
{% endhighlight %}
85134

86135

136+
## Console
87137

138+
Try to execute test commands in run-time. You may try commands before writing the test.
88139

89-
## GeneratePageObject
140+
* `codecept console acceptance` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
90141

91-
Generates PageObject. Can be generated either globally, or just for one suite.
92-
If PageObject is generated globally it will act as UIMap, without any logic in it.
93142

94-
* `codecept g:page Login`
95-
* `codecept g:page Registration`
96-
* `codecept g:page acceptance Login`
97143

144+
## GenerateFeature
98145

146+
Generates Feature file (in Gherkin):
99147

100-
## GenerateEnvironment
148+
* `codecept generate:feature suite Login`
149+
* `codecept g:feature suite subdir/subdir/login.feature`
150+
* `codecept g:feature suite login.feature -c path/to/project`
101151

102-
Generates empty environment configuration file into envs dir:
103152

104-
* `codecept g:env firefox`
105153

106-
Required to have `envs` path to be specified in `codeception.yml`
107154

108155

156+
## Bootstrap
109157

110-
## GenerateCest
158+
Creates default config, tests directory and sample suites for current project.
159+
Use this command to start building a test suite.
111160

112-
Generates Cest (scenario-driven object-oriented test) file:
161+
By default, it will create 3 suites **Acceptance**, **Functional**, and **Unit**.
113162

114-
* `codecept generate:cest suite Login`
115-
* `codecept g:cest suite subdir/subdir/testnameCest.php`
116-
* `codecept g:cest suite LoginCest -c path/to/project`
117-
* `codecept g:cest "App\Login"`
163+
* `codecept bootstrap` - creates `tests` dir and `codeception.yml` in current dir.
164+
* `codecept bootstrap --empty` - creates `tests` dir without suites
165+
* `codecept bootstrap --namespace Frontend` - creates tests, and use `Frontend` namespace for actor classes and helpers.
166+
* `codecept bootstrap --actor Wizard` - sets actor as Wizard, to have `TestWizard` actor in tests.
167+
* `codecept bootstrap path/to/the/project` - provide different path to a project, where tests should be placed
118168

119169

120170

@@ -128,209 +178,159 @@ Recursively cleans `output` directory and generated code.
128178

129179

130180

131-
## GenerateHelper
181+
## GeneratePageObject
132182

133-
Creates empty Helper class.
183+
Generates PageObject. Can be generated either globally, or just for one suite.
184+
If PageObject is generated globally it will act as UIMap, without any logic in it.
134185

135-
* `codecept g:helper MyHelper`
136-
* `codecept g:helper "My\Helper"`
186+
* `codecept g:page Login`
187+
* `codecept g:page Registration`
188+
* `codecept g:page acceptance Login`
137189

138190

139191

192+
## GenerateSnapshot
140193

141-
## GenerateSuite
194+
Generates Snapshot.
195+
Snapshot can be used to test dynamical data.
196+
If suite name is provided, an actor class will be included into placeholder
142197

143-
Create new test suite. Requires suite name and actor name
198+
* `codecept g:snapshot UserEmails`
199+
* `codecept g:snapshot Products`
200+
* `codecept g:snapshot acceptance UserEmails`
144201

145-
* ``
146-
* `codecept g:suite api` -> api + ApiTester
147-
* `codecept g:suite integration Code` -> integration + CodeTester
148-
* `codecept g:suite frontend Front` -> frontend + FrontTester
149202

150203

204+
## DryRun
151205

206+
Shows step-by-step execution process for scenario driven tests without actually running them.
152207

153-
## Console
208+
* `codecept dry-run acceptance`
209+
* `codecept dry-run acceptance MyCest`
210+
* `codecept dry-run acceptance checkout.feature`
211+
* `codecept dry-run tests/acceptance/MyCest.php`
154212

155-
Try to execute test commands in run-time. You may try commands before writing the test.
156213

157-
* `codecept console acceptance` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
158214

159215

216+
## GenerateCest
160217

161-
## GenerateSnapshot
218+
Generates Cest (scenario-driven object-oriented test) file:
162219

163-
Generates Snapshot.
164-
Snapshot can be used to test dynamical data.
165-
If suite name is provided, an actor class will be included into placeholder
220+
* `codecept generate:cest suite Login`
221+
* `codecept g:cest suite subdir/subdir/testnameCest.php`
222+
* `codecept g:cest suite LoginCest -c path/to/project`
223+
* `codecept g:cest "App\Login"`
166224

167-
* `codecept g:snapshot UserEmails`
168-
* `codecept g:snapshot Products`
169-
* `codecept g:snapshot acceptance UserEmails`
170225

171226

172227

173-
## Init
228+
## GenerateTest
174229

230+
Generates skeleton for Unit Test that extends `Codeception\TestCase\Test`.
175231

232+
* `codecept g:test unit User`
233+
* `codecept g:test unit "App\User"`
176234

177-
## GherkinSnippets
178235

179-
Generates code snippets for matched feature files in a suite.
180-
Code snippets are expected to be implemented in Actor or PageObjects
181236

182-
Usage:
237+
## ConfigValidate
183238

184-
* `codecept gherkin:snippets acceptance` - snippets from all feature of acceptance tests
185-
* `codecept gherkin:snippets acceptance/feature/users` - snippets from `feature/users` dir of acceptance tests
186-
* `codecept gherkin:snippets acceptance user_account.feature` - snippets from a single feature file
187-
* `codecept gherkin:snippets acceptance/feature/users/user_accout.feature` - snippets from feature file in a dir
239+
Validates and prints Codeception config.
240+
Use it do debug Yaml configs
188241

242+
Check config:
189243

244+
* `codecept config`: check global config
245+
* `codecept config unit`: check suite config
190246

191-
## GenerateStepObject
247+
Load config:
192248

193-
Generates StepObject class. You will be asked for steps you want to implement.
249+
* `codecept config:validate -c path/to/another/config`: from another dir
250+
* `codecept config:validate -c another_config.yml`: from another config file
194251

195-
* `codecept g:stepobject acceptance AdminSteps`
196-
* `codecept g:stepobject acceptance UserSteps --silent` - skip action questions
252+
Check overriding config values (like in `run` command)
197253

254+
* `codecept config:validate -o "settings: shuffle: true"`: enable shuffle
255+
* `codecept config:validate -o "settings: lint: false"`: disable linting
256+
* `codecept config:validate -o "reporters: report: \Custom\Reporter" --report`: use custom reporter
198257

199258

200259

201-
## CompletionFallback
202260

261+
## GenerateStepObject
203262

263+
Generates StepObject class. You will be asked for steps you want to implement.
204264

205-
## GenerateTest
265+
* `codecept g:stepobject acceptance AdminSteps`
266+
* `codecept g:stepobject acceptance UserSteps --silent` - skip action questions
206267

207-
Generates skeleton for Unit Test that extends `Codeception\TestCase\Test`.
208268

209-
* `codecept g:test unit User`
210-
* `codecept g:test unit "App\User"`
211269

212270

271+
## SelfUpdate
213272

214-
## Bootstrap
273+
Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar' .
215274

216-
Creates default config, tests directory and sample suites for current project.
217-
Use this command to start building a test suite.
275+
* `php codecept.phar self-update`
218276

219-
By default, it will create 3 suites **Acceptance**, **Functional**, and **Unit**.
277+
@author Franck Cassedanne <franck@cassedanne.com>
220278

221-
* `codecept bootstrap` - creates `tests` dir and `codeception.yml` in current dir.
222-
* `codecept bootstrap --empty` - creates `tests` dir without suites
223-
* `codecept bootstrap --namespace Frontend` - creates tests, and use `Frontend` namespace for actor classes and helpers.
224-
* `codecept bootstrap --actor Wizard` - sets actor as Wizard, to have `TestWizard` actor in tests.
225-
* `codecept bootstrap path/to/the/project` - provide different path to a project, where tests should be placed
226279

227280

281+
## GenerateSuite
228282

283+
Create new test suite. Requires suite name and actor name
229284

230-
## Run
285+
* ``
286+
* `codecept g:suite api` -> api + ApiTester
287+
* `codecept g:suite integration Code` -> integration + CodeTester
288+
* `codecept g:suite frontend Front` -> frontend + FrontTester
231289

232-
Executes tests.
233290

234-
Usage:
235291

236-
* `codecept run acceptance`: run all acceptance tests
237-
* `codecept run tests/acceptance/MyCest.php`: run only MyCest
238-
* `codecept run acceptance MyCest`: same as above
239-
* `codecept run acceptance MyCest:myTestInIt`: run one test from a Cest
240-
* `codecept run acceptance MyCest:myTestInIt#1`: run one example or data provider item by number
241-
* `codecept run acceptance MyCest:myTestInIt#1-3`: run a range of examples or data provider items
242-
* `codecept run acceptance MyCest:myTestInIt@name.*`: run data provider items with matching names
243-
* `codecept run acceptance checkout.feature`: run feature-file
244-
* `codecept run acceptance -g slow`: run tests from *slow* group
245-
* `codecept run unit,functional`: run only unit and functional suites
246292

247-
Verbosity modes:
293+
## Init
248294

249-
* `codecept run -v`:
250-
* `codecept run --steps`: print step-by-step execution
251-
* `codecept run -vv`: print steps and debug information
252-
* `codecept run --debug`: alias for `-vv`
253-
* `codecept run -vvv`: print Codeception-internal debug information
254295

255-
Load config:
256296

257-
* `codecept run -c path/to/another/config`: from another dir
258-
* `codecept run -c another_config.yml`: from another config file
297+
## GenerateGroup
259298

260-
Override config values:
299+
Creates empty GroupObject - extension which handles all group events.
261300

262-
* `codecept run -o "settings: shuffle: true"`: enable shuffle
263-
* `codecept run -o "settings: lint: false"`: disable linting
301+
* `codecept g:group Admin`
264302

265-
Run with specific extension
266303

267-
* `codecept run --ext Recorder` run with Recorder extension enabled
268-
* `codecept run --ext DotReporter` run with DotReporter printer
269-
* `codecept run --ext "My\Custom\Extension"` run with an extension loaded by class name
270304

271-
Full reference:
272-
{% highlight yaml %}
273-
Arguments:
274-
suite suite to be tested
275-
test test to be run
305+
## GenerateScenarios
276306

277-
Options:
278-
-o, --override=OVERRIDE Override config values (multiple values allowed)
279-
--config (-c) Use custom path for config
280-
--report Show output in compact style
281-
--html Generate html with results (default: "report.html")
282-
--xml Generate JUnit XML Log (default: "report.xml")
283-
--phpunit-xml Generate PhpUnit XML Log (default: "phpunit-report.xml")
284-
--no-redirect Do not redirect to Composer-installed version in vendor/codeception
285-
--colors Use colors in output
286-
--no-colors Force no colors in output (useful to override config file)
287-
--silent Only outputs suite names and final results. Almost the same as `--quiet`
288-
--steps Show steps in output
289-
--debug (-d) Alias for `-vv`
290-
--bootstrap Execute bootstrap script before the test
291-
--coverage Run with code coverage (default: "coverage.serialized")
292-
--disable-coverage-php Don't generate CodeCoverage report in raw PHP serialized format
293-
--coverage-html Generate CodeCoverage HTML report in path (default: "coverage")
294-
--coverage-xml Generate CodeCoverage XML report in file (default: "coverage.xml")
295-
--coverage-text Generate CodeCoverage text report in file (default: "coverage.txt")
296-
--coverage-phpunit Generate CodeCoverage PHPUnit report in file (default: "coverage-phpunit")
297-
--coverage-cobertura Generate CodeCoverage Cobertura report in file (default: "coverage-cobertura")
298-
--no-exit Don't finish with exit code
299-
--group (-g) Groups of tests to be executed (multiple values allowed)
300-
--skip (-s) Skip selected suites (multiple values allowed)
301-
--skip-group (-x) Skip selected groups (multiple values allowed)
302-
--env Run tests in selected environments. (multiple values allowed, environments can be merged with ',')
303-
--fail-fast (-f) Stop after nth failure (defaults to 1)
304-
--no-rebuild Do not rebuild actor classes on start
305-
--help (-h) Display this help message.
306-
--quiet (-q) Do not output any message. Almost the same as `--silent`
307-
--verbose (-v|vv|vvv) Increase the verbosity of messages: `v` for normal output, `vv` for steps and debug, `vvv` for Codeception-internal debug
308-
--version (-V) Display this application version.
309-
--ansi Force ANSI output.
310-
--no-ansi Disable ANSI output.
311-
--no-interaction (-n) Do not ask any interactive question.
312-
--seed Use the given seed for shuffling tests
307+
Generates user-friendly text scenarios from scenario-driven tests (Cest).
313308

314-
{% endhighlight %}
309+
* `codecept g:scenarios acceptance` - for all acceptance tests
310+
* `codecept g:scenarios acceptance --format html` - in html format
311+
* `codecept g:scenarios acceptance --path doc` - generate scenarios to `doc` dir
315312

316313

317314

315+
## GenerateHelper
318316

319-
## SelfUpdate
317+
Creates empty Helper class.
320318

321-
Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar' .
319+
* `codecept g:helper MyHelper`
320+
* `codecept g:helper "My\Helper"`
322321

323-
* `php codecept.phar self-update`
324322

325-
@author Franck Cassedanne <franck@cassedanne.com>
326323

327324

325+
## GherkinSteps
328326

329-
## GenerateGroup
327+
Prints all steps from all Gherkin contexts for a specific suite
330328

331-
Creates empty GroupObject - extension which handles all group events.
329+
{% highlight yaml %}
330+
codecept gherkin:steps acceptance
331+
332+
{% endhighlight %}
332333

333-
* `codecept g:group Admin`
334334

335335

336336

0 commit comments

Comments
 (0)
Please sign in to comment.