@@ -5,17 +5,37 @@ title: Commands - Codeception - Documentation
55
66# Console Commands
77
8- ## GherkinSteps
8+ ## GenerateStepObject
99
10- Prints all steps from all Gherkin contexts for a specific suite
10+ Generates StepObject class. You will be asked for steps you want to implement.
1111
12- {% highlight yaml %}
13- codecept gherkin : steps acceptance
12+ * ` codecept g:stepobject acceptance AdminSteps `
13+ * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
1414
15- {% endhighlight %}
1615
1716
1817
18+ ## GenerateScenarios
19+
20+ Generates user-friendly text scenarios from scenario-driven tests (Cest).
21+
22+ * ` codecept g:scenarios acceptance ` - for all acceptance tests
23+ * ` codecept g:scenarios acceptance --format html ` - in html format
24+ * ` codecept g:scenarios acceptance --path doc ` - generate scenarios to ` doc ` dir
25+
26+
27+
28+ ## GenerateSnapshot
29+
30+ Generates Snapshot.
31+ Snapshot can be used to test dynamical data.
32+ If suite name is provided, an actor class will be included into placeholder
33+
34+ * ` codecept g:snapshot UserEmails `
35+ * ` codecept g:snapshot Products `
36+ * ` codecept g:snapshot acceptance UserEmails `
37+
38+
1939
2040## DryRun
2141
@@ -29,46 +49,57 @@ Shows step-by-step execution process for scenario driven tests without actually
2949
3050
3151
32- ## Init
52+ ## GenerateTest
3353
54+ Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
3455
56+ * ` codecept g:test unit User `
57+ * ` codecept g:test unit "App\User" `
3558
36- ## GenerateCest
3759
38- Generates Cest (scenario-driven object-oriented test) file:
3960
40- * ` codecept generate:cest suite Login `
41- * ` codecept g:cest suite subdir/subdir/testnameCest.php `
42- * ` codecept g:cest suite LoginCest -c path/to/project `
43- * ` codecept g:cest "App\Login" `
61+ ## GenerateHelper
4462
63+ Creates empty Helper class.
4564
65+ * ` codecept g:helper MyHelper `
66+ * ` codecept g:helper "My\Helper" `
4667
4768
48- ## SelfUpdate
4969
50- Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar ' .
5170
52- * ` php codecept.phar self-update `
71+ ## GherkinSnippets
5372
54- @author Franck Cassedanne
< [email protected] > 73+ Generates code snippets for matched feature files in a suite.
74+ Code snippets are expected to be implemented in Actor or PageObjects
5575
76+ Usage:
5677
78+ * ` codecept gherkin:snippets acceptance ` - snippets from all feature of acceptance tests
79+ * ` codecept gherkin:snippets acceptance/feature/users ` - snippets from ` feature/users ` dir of acceptance tests
80+ * ` codecept gherkin:snippets acceptance user_account.feature ` - snippets from a single feature file
81+ * ` codecept gherkin:snippets acceptance/feature/users/user_accout.feature ` - snippets from feature file in a dir
5782
58- ## GenerateTest
5983
60- Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
6184
62- * ` codecept g:test unit User `
63- * ` codecept g:test unit "App\User" `
85+ ## GeneratePageObject
6486
87+ Generates PageObject. Can be generated either globally, or just for one suite.
88+ If PageObject is generated globally it will act as UIMap, without any logic in it.
6589
90+ * ` codecept g:page Login `
91+ * ` codecept g:page Registration `
92+ * ` codecept g:page acceptance Login `
6693
67- ## GenerateGroup
6894
69- Creates empty GroupObject - extension which handles all group events.
7095
71- * ` codecept g:group Admin `
96+ ## GenerateEnvironment
97+
98+ Generates empty environment configuration file into envs dir:
99+
100+ * ` codecept g:env firefox `
101+
102+ Required to have ` envs ` path to be specified in ` codeception.yml `
72103
73104
74105
@@ -165,171 +196,140 @@ Options:
165196
166197
167198
168- ## GenerateStepObject
169-
170- Generates StepObject class. You will be asked for steps you want to implement.
171-
172- * ` codecept g:stepobject acceptance AdminSteps `
173- * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
174-
175-
176-
177-
178- ## GenerateSnapshot
179-
180- Generates Snapshot.
181- Snapshot can be used to test dynamical data.
182- If suite name is provided, an actor class will be included into placeholder
183-
184- * ` codecept g:snapshot UserEmails `
185- * ` codecept g:snapshot Products `
186- * ` codecept g:snapshot acceptance UserEmails `
187-
188-
189-
190- ## GenerateScenarios
191-
192- Generates user-friendly text scenarios from scenario-driven tests (Cest).
199+ ## GherkinSteps
193200
194- * ` codecept g:scenarios acceptance ` - for all acceptance tests
195- * ` codecept g:scenarios acceptance --format html ` - in html format
196- * ` codecept g:scenarios acceptance --path doc ` - generate scenarios to ` doc ` dir
201+ Prints all steps from all Gherkin contexts for a specific suite
197202
203+ {% highlight yaml %}
204+ codecept gherkin: steps acceptance
198205
206+ {% endhighlight %}
199207
200- ## GeneratePageObject
201208
202- Generates PageObject. Can be generated either globally, or just for one suite.
203- If PageObject is generated globally it will act as UIMap, without any logic in it.
204209
205- * ` codecept g:page Login `
206- * ` codecept g:page Registration `
207- * ` codecept g:page acceptance Login `
208210
211+ ## Clean
209212
213+ Recursively cleans ` output ` directory and generated code.
210214
211- ## ConfigValidate
215+ * ` codecept clean `
212216
213- Validates and prints Codeception config.
214- Use it do debug Yaml configs
215217
216- Check config:
217218
218- * ` codecept config ` : check global config
219- * ` codecept config unit ` : check suite config
220219
221- Load config:
220+ ## Init
222221
223- * ` codecept config:validate -c path/to/another/config ` : from another dir
224- * ` codecept config:validate -c another_config.yml ` : from another config file
225222
226- Check overriding config values (like in ` run ` command)
227223
228- * ` codecept config:validate -o "settings: shuffle: true" ` : enable shuffle
229- * ` codecept config:validate -o "settings: lint: false" ` : disable linting
230- * ` codecept config:validate -o "reporters: report: \Custom\Reporter" --report ` : use custom reporter
224+ ## GenerateCest
231225
226+ Generates Cest (scenario-driven object-oriented test) file:
232227
228+ * ` codecept generate:cest suite Login `
229+ * ` codecept g:cest suite subdir/subdir/testnameCest.php `
230+ * ` codecept g:cest suite LoginCest -c path/to/project `
231+ * ` codecept g:cest "App\Login" `
233232
234233
235- ## GenerateHelper
236234
237- Creates empty Helper class.
238235
239- * ` codecept g:helper MyHelper `
240- * ` codecept g:helper "My\Helper" `
236+ ## Console
241237
238+ Try to execute test commands in run-time. You may try commands before writing the test.
242239
240+ * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
243241
244242
245- ## Bootstrap
246243
247- Creates default config, tests directory and sample suites for current project.
248- Use this command to start building a test suite.
244+ ## GenerateSuite
249245
250- By default, it will create 3 suites ** Acceptance ** , ** Functional ** , and ** Unit ** .
246+ Create new test suite. Requires suite name and actor name
251247
252- * ` codecept bootstrap ` - creates ` tests ` dir and ` codeception.yml ` in current dir.
253- * ` codecept bootstrap --empty ` - creates ` tests ` dir without suites
254- * ` codecept bootstrap --namespace Frontend ` - creates tests, and use ` Frontend ` namespace for actor classes and helpers.
255- * ` codecept bootstrap --actor Wizard ` - sets actor as Wizard, to have ` TestWizard ` actor in tests.
256- * ` codecept bootstrap path/to/the/project ` - provide different path to a project, where tests should be placed
248+ * ``
249+ * ` codecept g:suite api ` -> api + ApiTester
250+ * ` codecept g:suite integration Code ` -> integration + CodeTester
251+ * ` codecept g:suite frontend Front ` -> frontend + FrontTester
257252
258253
259254
260255
261- ## GenerateEnvironment
256+ ## GenerateGroup
262257
263- Generates empty environment configuration file into envs dir:
258+ Creates empty GroupObject - extension which handles all group events.
264259
265- * ` codecept g:env firefox `
260+ * ` codecept g:group Admin `
266261
267- Required to have ` envs ` path to be specified in ` codeception.yml `
268262
269263
264+ ## SelfUpdate
270265
271- ## Console
266+ Auto-updates phar archive from official site: ' https://codeception.com/codecept.phar ' .
272267
273- Try to execute test commands in run-time. You may try commands before writing the test.
268+ * ` php codecept.phar self-update `
274269
275- * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
270+ @ author Franck Cassedanne < [email protected] > 276271
277272
278273
279- ## GenerateSuite
274+ ## Build
280275
281- Create new test suite. Requires suite name and actor name
276+ Generates Actor classes (initially Guy classes) from suite configs.
277+ Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
282278
283- * ``
284- * ` codecept g:suite api ` -> api + ApiTester
285- * ` codecept g:suite integration Code ` -> integration + CodeTester
286- * ` codecept g:suite frontend Front ` -> frontend + FrontTester
279+ * ` codecept build `
280+ * ` codecept build path/to/project `
287281
288282
289283
290284
291- ## Build
285+ ## GenerateFeature
292286
293- Generates Actor classes (initially Guy classes) from suite configs.
294- Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
287+ Generates Feature file (in Gherkin):
295288
296- * ` codecept build `
297- * ` codecept build path/to/project `
289+ * ` codecept generate:feature suite Login `
290+ * ` codecept g:feature suite subdir/subdir/login.feature `
291+ * ` codecept g:feature suite login.feature -c path/to/project `
298292
299293
300294
301295
302- ## Clean
296+ ## Bootstrap
303297
304- Recursively cleans ` output ` directory and generated code.
298+ Creates default config, tests directory and sample suites for current project.
299+ Use this command to start building a test suite.
305300
306- * ` codecept clean `
301+ By default, it will create 3 suites ** Acceptance ** , ** Functional ** , and ** Unit ** .
307302
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
308308
309309
310310
311311
312- ## GherkinSnippets
312+ ## ConfigValidate
313313
314- Generates code snippets for matched feature files in a suite .
315- Code snippets are expected to be implemented in Actor or PageObjects
314+ Validates and prints Codeception config .
315+ Use it do debug Yaml configs
316316
317- Usage :
317+ Check config :
318318
319- * ` codecept gherkin:snippets acceptance ` - snippets from all feature of acceptance tests
320- * ` codecept gherkin:snippets acceptance/feature/users ` - snippets from ` feature/users ` dir of acceptance tests
321- * ` codecept gherkin:snippets acceptance user_account.feature ` - snippets from a single feature file
322- * ` codecept gherkin:snippets acceptance/feature/users/user_accout.feature ` - snippets from feature file in a dir
319+ * ` codecept config ` : check global config
320+ * ` codecept config unit ` : check suite config
323321
322+ Load config:
324323
324+ * ` codecept config:validate -c path/to/another/config ` : from another dir
325+ * ` codecept config:validate -c another_config.yml ` : from another config file
325326
326- ## GenerateFeature
327+ Check overriding config values (like in ` run ` command)
327328
328- Generates Feature file (in Gherkin):
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
329332
330- * ` codecept generate:feature suite Login `
331- * ` codecept g:feature suite subdir/subdir/login.feature `
332- * ` codecept g:feature suite login.feature -c path/to/project `
333333
334334
335335
0 commit comments