@@ -5,6 +5,17 @@ title: Commands - Codeception - Documentation
55
66# Console Commands
77
8+ ## GherkinSteps
9+
10+ Prints all steps from all Gherkin contexts for a specific suite
11+
12+ {% highlight yaml %}
13+ codecept gherkin: steps Acceptance
14+
15+ {% endhighlight %}
16+
17+
18+
819## GenerateStepObject
920
1021Generates StepObject class. You will be asked for steps you want to implement.
@@ -15,20 +26,19 @@ Generates StepObject class. You will be asked for steps you want to implement.
1526
1627
1728
18- ## GenerateHelper
19-
20- Creates empty Helper class.
21-
22- * ` codecept g:helper MyHelper `
23- * ` codecept g:helper "My\Helper" `
29+ ## Bootstrap
2430
31+ Creates default config, tests directory and sample suites for current project.
32+ Use this command to start building a test suite.
2533
34+ By default, it will create 3 suites ** Acceptance** , ** Functional** , and ** Unit** .
2635
27- ## GenerateGroup
36+ * ` codecept bootstrap ` - creates ` tests ` dir and ` codeception.yml ` in current dir.
37+ * ` codecept bootstrap --empty ` - creates ` tests ` dir without suites
38+ * ` codecept bootstrap --namespace Frontend ` - creates tests, and use ` Frontend ` namespace for actor classes and helpers.
39+ * ` codecept bootstrap --actor Wizard ` - sets actor as Wizard, to have ` TestWizard ` actor in tests.
40+ * ` codecept bootstrap path/to/the/project ` - provide different path to a project, where tests should be placed
2841
29- Creates empty GroupObject - extension which handles all group events.
30-
31- * ` codecept g:group Admin `
3242
3343
3444
@@ -46,62 +56,6 @@ Usage:
4656
4757
4858
49- ## Clean
50-
51- Recursively cleans ` output ` directory and generated code.
52-
53- * ` codecept clean `
54-
55-
56-
57-
58- ## Console
59-
60- Try to execute test commands in run-time. You may try commands before writing the test.
61-
62- * ` codecept console Acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
63-
64-
65-
66- ## CompletionFallback
67-
68-
69-
70- ## GenerateSnapshot
71-
72- Generates Snapshot.
73- Snapshot can be used to test dynamical data.
74- If suite name is provided, an actor class will be included into placeholder
75-
76- * ` codecept g:snapshot UserEmails `
77- * ` codecept g:snapshot Products `
78- * ` codecept g:snapshot Acceptance UserEmails `
79-
80-
81-
82-
83- ## GenerateScenarios
84-
85- Generates user-friendly text scenarios from scenario-driven tests (Cest).
86-
87- * ` codecept g:scenarios Acceptance ` - for all acceptance tests
88- * ` codecept g:scenarios Acceptance --format html ` - in html format
89- * ` codecept g:scenarios Acceptance --path doc ` - generate scenarios to ` doc ` dir
90-
91-
92-
93- ## GenerateCest
94-
95- Generates Cest (scenario-driven object-oriented test) file:
96-
97- * ` codecept generate:cest suite Login `
98- * ` codecept g:cest suite subdir/subdir/testnameCest.php `
99- * ` codecept g:cest suite LoginCest -c path/to/project `
100- * ` codecept g:cest "App\Login" `
101-
102-
103-
104-
10559## Run
10660
10761Executes tests.
@@ -195,18 +149,24 @@ Options:
195149
196150
197151
198- ## Bootstrap
152+ ## GenerateCest
199153
200- Creates default config, tests directory and sample suites for current project.
201- Use this command to start building a test suite.
154+ Generates Cest (scenario-driven object-oriented test) file:
202155
203- By default, it will create 3 suites ** Acceptance** , ** Functional** , and ** Unit** .
156+ * ` codecept generate:cest suite Login `
157+ * ` codecept g:cest suite subdir/subdir/testnameCest.php `
158+ * ` codecept g:cest suite LoginCest -c path/to/project `
159+ * ` codecept g:cest "App\Login" `
204160
205- * ` codecept bootstrap ` - creates ` tests ` dir and ` codeception.yml ` in current dir.
206- * ` codecept bootstrap --empty ` - creates ` tests ` dir without suites
207- * ` codecept bootstrap --namespace Frontend ` - creates tests, and use ` Frontend ` namespace for actor classes and helpers.
208- * ` codecept bootstrap --actor Wizard ` - sets actor as Wizard, to have ` TestWizard ` actor in tests.
209- * ` codecept bootstrap path/to/the/project ` - provide different path to a project, where tests should be placed
161+
162+
163+
164+ ## GenerateHelper
165+
166+ Creates empty Helper class.
167+
168+ * ` codecept g:helper MyHelper `
169+ * ` codecept g:helper "My\Helper" `
210170
211171
212172
@@ -233,6 +193,16 @@ Starting from Codeception 2.0 actor classes are auto-generated. Use this command
233193
234194
235195
196+ ## GenerateEnvironment
197+
198+ Generates empty environment configuration file into envs dir:
199+
200+ * ` codecept g:env firefox `
201+
202+ Required to have ` envs ` path to be specified in ` codeception.yml `
203+
204+
205+
236206## SelfUpdate
237207
238208Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar ' .
@@ -243,88 +213,106 @@ Auto-updates phar archive from official site: 'https://codeception.com/codecept.
243213
244214
245215
246- ## GherkinSteps
247-
248- Prints all steps from all Gherkin contexts for a specific suite
216+ ## DryRun
249217
250- {% highlight yaml %}
251- codecept gherkin: steps Acceptance
218+ Shows step-by-step execution process for scenario driven tests without actually running them.
252219
253- {% endhighlight %}
220+ * ` codecept dry-run Acceptance `
221+ * ` codecept dry-run Acceptance MyCest `
222+ * ` codecept dry-run Acceptance checkout.feature `
223+ * ` codecept dry-run tests/Acceptance/MyCest.php `
254224
255225
256226
257- ## GenerateSuite
258227
259- Create new test suite. Requires suite name and actor name
228+ ## ConfigValidate
260229
261- * ``
262- * ` codecept g:suite Api ` -> api + ApiTester
263- * ` codecept g:suite Integration Code ` -> integration + CodeTester
264- * ` codecept g:suite Frontend Front ` -> frontend + FrontTester
230+ Validates and prints Codeception config.
231+ Use it do debug Yaml configs
265232
233+ Check config:
266234
235+ * ` codecept config ` : check global config
236+ * ` codecept config Unit ` : check suite config
267237
238+ Load config:
268239
269- ## GenerateEnvironment
240+ * ` codecept config:validate -c path/to/another/config ` : from another dir
241+ * ` codecept config:validate -c another_config.yml ` : from another config file
270242
271- Generates empty environment configuration file into envs dir:
243+ Check overriding config values (like in ` run ` command)
272244
273- * ` codecept g:env firefox `
245+ * ` codecept config:validate -o "settings: shuffle: true" ` : enable shuffle
246+ * ` codecept config:validate -o "settings: lint: false" ` : disable linting
247+ * ` codecept config:validate -o "reporters: report: \Custom\Reporter" --report ` : use custom reporter
274248
275- Required to have ` envs ` path to be specified in ` codeception.yml `
276249
277250
278251
279252## Init
280253
281254
282255
283- ## GenerateTest
256+ ## CompletionFallback
284257
285- Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
286258
287- * ` codecept g:test Unit User `
288- * ` codecept g:test Unit "App\User" `
289259
260+ ## GenerateScenarios
290261
262+ Generates user-friendly text scenarios from scenario-driven tests (Cest).
291263
292- ## DryRun
264+ * ` codecept g:scenarios Acceptance ` - for all acceptance tests
265+ * ` codecept g:scenarios Acceptance --format html ` - in html format
266+ * ` codecept g:scenarios Acceptance --path doc ` - generate scenarios to ` doc ` dir
293267
294- Shows step-by-step execution process for scenario driven tests without actually running them.
295268
296- * ` codecept dry-run Acceptance `
297- * ` codecept dry-run Acceptance MyCest `
298- * ` codecept dry-run Acceptance checkout.feature `
299- * ` codecept dry-run tests/Acceptance/MyCest.php `
300269
270+ ## Console
301271
272+ Try to execute test commands in run-time. You may try commands before writing the test.
302273
274+ * ` codecept console Acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
303275
304- ## ConfigValidate
305276
306- Validates and prints Codeception config.
307- Use it do debug Yaml configs
308277
309- Check config:
278+ ## Clean
310279
311- * ` codecept config ` : check global config
312- * ` codecept config Unit ` : check suite config
280+ Recursively cleans ` output ` directory and generated code.
313281
314- Load config:
282+ * ` codecept clean `
315283
316- * ` codecept config:validate -c path/to/another/config ` : from another dir
317- * ` codecept config:validate -c another_config.yml ` : from another config file
318284
319- Check overriding config values (like in ` run ` command)
320285
321- * ` codecept config:validate -o "settings: shuffle: true" ` : enable shuffle
322- * ` codecept config:validate -o "settings: lint: false" ` : disable linting
323- * ` codecept config:validate -o "reporters: report: \Custom\Reporter" --report ` : use custom reporter
286+
287+ ## GenerateSuite
288+
289+ Create new test suite. Requires suite name and actor name
290+
291+ * ``
292+ * ` codecept g:suite Api ` -> api + ApiTester
293+ * ` codecept g:suite Integration Code ` -> integration + CodeTester
294+ * ` codecept g:suite Frontend Front ` -> frontend + FrontTester
324295
325296
326297
327298
299+ ## GenerateGroup
300+
301+ Creates empty GroupObject - extension which handles all group events.
302+
303+ * ` codecept g:group Admin `
304+
305+
306+
307+ ## GenerateTest
308+
309+ Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
310+
311+ * ` codecept g:test Unit User `
312+ * ` codecept g:test Unit "App\User" `
313+
314+
315+
328316## GenerateFeature
329317
330318Generates Feature file (in Gherkin):
@@ -336,3 +324,15 @@ Generates Feature file (in Gherkin):
336324
337325
338326
327+ ## GenerateSnapshot
328+
329+ Generates Snapshot.
330+ Snapshot can be used to test dynamical data.
331+ If suite name is provided, an actor class will be included into placeholder
332+
333+ * ` codecept g:snapshot UserEmails `
334+ * ` codecept g:snapshot Products `
335+ * ` codecept g:snapshot Acceptance UserEmails `
336+
337+
338+
0 commit comments