@@ -5,89 +5,57 @@ title: Commands - Codeception - Documentation
55
66# Console Commands
77
8- ## GenerateCest
9-
10- Generates Cest (scenario-driven object-oriented test) file:
11-
12- * ` codecept generate:cest suite Login `
13- * ` codecept g:cest suite subdir/subdir/testnameCest.php `
14- * ` codecept g:cest suite LoginCest -c path/to/project `
15- * ` codecept g:cest "App\Login" `
16-
17-
18-
19-
20- ## Clean
21-
22- Recursively cleans ` output ` directory and generated code.
23-
24- * ` codecept clean `
25-
26-
27-
28-
29- ## Console
30-
31- Try to execute test commands in run-time. You may try commands before writing the test.
32-
33- * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
34-
35-
36-
37- ## GenerateGroup
8+ ## SelfUpdate
389
39- Creates empty GroupObject - extension which handles all group events .
10+ Auto-updates phar archive from official site: ' https://codeception.com/codecept.phar ' .
4011
41- * ` codecept g:group Admin `
12+ * ` php codecept.phar self-update `
4213
14+ @author Franck Cassedanne < franck@cassedanne.com >
4315
4416
45- ## Build
4617
47- Generates Actor classes (initially Guy classes) from suite configs.
48- Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
18+ ## Init
4919
50- * ` codecept build `
51- * ` codecept build path/to/project `
5220
5321
22+ ## GherkinSnippets
5423
24+ Generates code snippets for matched feature files in a suite.
25+ Code snippets are expected to be implemented in Actor or PageObjects
5526
56- ## GenerateSuite
27+ Usage:
5728
58- Create new test suite. Requires suite name and actor name
29+ * ` codecept gherkin:snippets acceptance ` - snippets from all feature of acceptance tests
30+ * ` codecept gherkin:snippets acceptance/feature/users ` - snippets from ` feature/users ` dir of acceptance tests
31+ * ` codecept gherkin:snippets acceptance user_account.feature ` - snippets from a single feature file
32+ * ` codecept gherkin:snippets acceptance/feature/users/user_accout.feature ` - snippets from feature file in a dir
5933
60- * ``
61- * ` codecept g:suite api ` -> api + ApiTester
62- * ` codecept g:suite integration Code ` -> integration + CodeTester
63- * ` codecept g:suite frontend Front ` -> frontend + FrontTester
6434
6535
36+ ## GenerateEnvironment
6637
38+ Generates empty environment configuration file into envs dir:
6739
68- ## GenerateSnapshot
40+ * ` codecept g:env firefox `
6941
70- Generates Snapshot.
71- Snapshot can be used to test dynamical data.
72- If suite name is provided, an actor class will be included into placeholder
42+ Required to have ` envs ` path to be specified in ` codeception.yml `
7343
74- * ` codecept g:snapshot UserEmails `
75- * ` codecept g:snapshot Products `
76- * ` codecept g:snapshot acceptance UserEmails `
7744
7845
46+ ## CompletionFallback
7947
80- ## GenerateScenarios
8148
82- Generates user-friendly text scenarios from scenario-driven tests (Cest).
8349
84- * ` codecept g:scenarios acceptance ` - for all acceptance tests
85- * ` codecept g:scenarios acceptance --format html ` - in html format
86- * ` codecept g:scenarios acceptance --path doc ` - generate scenarios to ` doc ` dir
50+ ## DryRun
8751
52+ Shows step by step execution process for scenario driven tests without actually running them.
8853
54+ * ` codecept dry-run acceptance `
55+ * ` codecept dry-run acceptance MyCest `
56+ * ` codecept dry-run acceptance checkout.feature `
57+ * ` codecept dry-run tests/acceptance/MyCest.php `
8958
90- ## CompletionFallback
9159
9260
9361
@@ -101,83 +69,76 @@ Creates empty Helper class.
10169
10270
10371
104- ## GenerateTest
72+ ## GenerateSuite
10573
106- Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
74+ Create new test suite. Requires suite name and actor name
10775
108- * ` codecept g:test unit User `
109- * ` codecept g:test unit "App\User" `
76+ * ``
77+ * ` codecept g:suite api ` -> api + ApiTester
78+ * ` codecept g:suite integration Code ` -> integration + CodeTester
79+ * ` codecept g:suite frontend Front ` -> frontend + FrontTester
11080
11181
11282
113- ## GenerateFeature
11483
115- Generates Feature file (in Gherkin):
84+ ## Build
11685
117- * ` codecept generate:feature suite Login `
118- * ` codecept g:feature suite subdir/subdir/login.feature `
119- * ` codecept g:feature suite login.feature -c path/to/project `
86+ Generates Actor classes (initially Guy classes) from suite configs.
87+ Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
12088
89+ * ` codecept build `
90+ * ` codecept build path/to/project `
12191
12292
12393
124- ## GeneratePageObject
12594
126- Generates PageObject. Can be generated either globally, or just for one suite.
127- If PageObject is generated globally it will act as UIMap, without any logic in it.
95+ ## GenerateSnapshot
12896
129- * ` codecept g:page Login `
130- * ` codecept g:page Registration `
131- * ` codecept g:page acceptance Login `
97+ Generates Snapshot.
98+ Snapshot can be used to test dynamical data.
99+ If suite name is provided, an actor class will be included into placeholder
132100
101+ * ` codecept g:snapshot UserEmails `
102+ * ` codecept g:snapshot Products `
103+ * ` codecept g:snapshot acceptance UserEmails `
133104
134105
135- ## Bootstrap
136106
137- Creates default config, tests directory and sample suites for current project.
138- Use this command to start building a test suite.
107+ ## Clean
139108
140- By default it will create 3 suites ** Acceptance ** , ** Functional ** , and ** Unit ** .
109+ Recursively cleans ` output ` directory and generated code .
141110
142- * ` codecept bootstrap ` - creates ` tests ` dir and ` codeception.yml ` in current dir.
143- * ` codecept bootstrap --empty ` - creates ` tests ` dir without suites
144- * ` codecept bootstrap --namespace Frontend ` - creates tests, and use ` Frontend ` namespace for actor classes and helpers.
145- * ` codecept bootstrap --actor Wizard ` - sets actor as Wizard, to have ` TestWizard ` actor in tests.
146- * ` codecept bootstrap path/to/the/project ` - provide different path to a project, where tests should be placed
111+ * ` codecept clean `
147112
148113
149114
150115
151- ## GenerateEnvironment
116+ ## Console
152117
153- Generates empty environment configuration file into envs dir:
118+ Try to execute test commands in run-time. You may try commands before writing the test.
154119
155- * ` codecept g:env firefox `
120+ * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
156121
157- Required to have ` envs ` path to be specified in ` codeception.yml `
158122
159123
124+ ## GenerateStepObject
160125
161- ## ConfigValidate
126+ Generates StepObject class. You will be asked for steps you want to implement.
162127
163- Validates and prints Codeception config.
164- Use it do debug Yaml configs
128+ * ` codecept g:stepobject acceptance AdminSteps `
129+ * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
165130
166- Check config:
167131
168- * ` codecept config ` : check global config
169- * ` codecept config unit ` : check suite config
170132
171- Load config:
172133
173- * ` codecept config:validate -c path/to/another/config ` : from another dir
174- * ` codecept config:validate -c another_config.yml ` : from another config file
134+ ## GherkinSteps
175135
176- Check overriding config values (like in ` run ` command)
136+ Prints all steps from all Gherkin contexts for a specific suite
177137
178- * ` codecept config:validate -o "settings: shuffle: true" ` : enable shuffle
179- * ` codecept config:validate -o "settings: lint: false" ` : disable linting
180- * ` codecept config:validate -o "reporters: report: \Custom\Reporter" --report ` : use custom reporter
138+ {% highlight yaml %}
139+ codecept gherkin: steps acceptance
140+
141+ {% endhighlight %}
181142
182143
183144
@@ -270,65 +231,104 @@ Options:
270231
271232
272233
234+ ## GeneratePageObject
273235
274- ## GherkinSnippets
236+ Generates PageObject. Can be generated either globally, or just for one suite.
237+ If PageObject is generated globally it will act as UIMap, without any logic in it.
275238
276- Generates code snippets for matched feature files in a suite.
277- Code snippets are expected to be implemented in Actor or PageObjects
239+ * ` codecept g:page Login `
240+ * ` codecept g:page Registration `
241+ * ` codecept g:page acceptance Login `
278242
279- Usage:
280243
281- * ` codecept gherkin:snippets acceptance ` - snippets from all feature of acceptance tests
282- * ` codecept gherkin:snippets acceptance/feature/users ` - snippets from ` feature/users ` dir of acceptance tests
283- * ` codecept gherkin:snippets acceptance user_account.feature ` - snippets from a single feature file
284- * ` codecept gherkin:snippets acceptance/feature/users/user_accout.feature ` - snippets from feature file in a dir
285244
245+ ## GenerateFeature
286246
247+ Generates Feature file (in Gherkin):
287248
288- ## SelfUpdate
249+ * ` codecept generate:feature suite Login `
250+ * ` codecept g:feature suite subdir/subdir/login.feature `
251+ * ` codecept g:feature suite login.feature -c path/to/project `
289252
290- Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar ' .
291253
292- * ` php codecept.phar self-update `
293254
294- @author Franck Cassedanne < franck@cassedanne.com >
295255
256+ ## GenerateGroup
296257
258+ Creates empty GroupObject - extension which handles all group events.
297259
298- ## Init
260+ * ` codecept g:group Admin `
299261
300262
301263
302- ## GherkinSteps
264+ ## GenerateScenarios
303265
304- Prints all steps from all Gherkin contexts for a specific suite
266+ Generates user-friendly text scenarios from scenario-driven tests (Cest).
305267
306- {% highlight yaml %}
307- codecept gherkin: steps acceptance
268+ * ` codecept g:scenarios acceptance ` - for all acceptance tests
269+ * ` codecept g:scenarios acceptance --format html ` - in html format
270+ * ` codecept g:scenarios acceptance --path doc ` - generate scenarios to ` doc ` dir
308271
309- {% endhighlight %}
310272
311273
312274
275+ ## GenerateTest
313276
314- ## GenerateStepObject
277+ Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
315278
316- Generates StepObject class. You will be asked for steps you want to implement.
279+ * ` codecept g:test unit User `
280+ * ` codecept g:test unit "App\User" `
317281
318- * ` codecept g:stepobject acceptance AdminSteps `
319- * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
320282
321283
284+ ## GenerateCest
322285
286+ Generates Cest (scenario-driven object-oriented test) file:
323287
324- ## DryRun
288+ * ` codecept generate:cest suite Login `
289+ * ` codecept g:cest suite subdir/subdir/testnameCest.php `
290+ * ` codecept g:cest suite LoginCest -c path/to/project `
291+ * ` codecept g:cest "App\Login" `
325292
326- Shows step by step execution process for scenario driven tests without actually running them.
327293
328- * ` codecept dry-run acceptance `
329- * ` codecept dry-run acceptance MyCest `
330- * ` codecept dry-run acceptance checkout.feature `
331- * ` codecept dry-run tests/acceptance/MyCest.php `
294+
295+
296+ ## Bootstrap
297+
298+ Creates default config, tests directory and sample suites for current project.
299+ Use this command to start building a test suite.
300+
301+ By default it will create 3 suites ** Acceptance** , ** Functional** , and ** Unit** .
302+
303+ * ` codecept bootstrap ` - creates ` tests ` dir and ` codeception.yml ` in current dir.
304+ * ` codecept bootstrap --empty ` - creates ` tests ` dir without suites
305+ * ` codecept bootstrap --namespace Frontend ` - creates tests, and use ` Frontend ` namespace for actor classes and helpers.
306+ * ` codecept bootstrap --actor Wizard ` - sets actor as Wizard, to have ` TestWizard ` actor in tests.
307+ * ` codecept bootstrap path/to/the/project ` - provide different path to a project, where tests should be placed
308+
309+
310+
311+
312+ ## ConfigValidate
313+
314+ Validates and prints Codeception config.
315+ Use it do debug Yaml configs
316+
317+ Check config:
318+
319+ * ` codecept config ` : check global config
320+ * ` codecept config unit ` : check suite config
321+
322+ Load config:
323+
324+ * ` codecept config:validate -c path/to/another/config ` : from another dir
325+ * ` codecept config:validate -c another_config.yml ` : from another config file
326+
327+ Check overriding config values (like in ` run ` command)
328+
329+ * ` codecept config:validate -o "settings: shuffle: true" ` : enable shuffle
330+ * ` codecept config:validate -o "settings: lint: false" ` : disable linting
331+ * ` codecept config:validate -o "reporters: report: \Custom\Reporter" --report ` : use custom reporter
332332
333333
334334
0 commit comments