@@ -5,58 +5,90 @@ title: Commands - Codeception - Documentation
55
66# Console Commands
77
8- ## SelfUpdate
8+ ## GenerateCest
99
10- Auto-updates phar archive from official site: ' https://codeception.com/codecept.phar ' .
10+ Generates Cest (scenario-driven object-oriented test) file:
1111
12- * ` php codecept.phar self-update `
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" `
1316
14- @author Franck Cassedanne < franck@cassedanne.com >
1517
1618
1719
18- ## Init
20+ ## Clean
1921
22+ Recursively cleans ` output ` directory and generated code.
2023
24+ * ` codecept clean `
2125
22- ## GherkinSnippets
2326
24- Generates code snippets for matched feature files in a suite.
25- Code snippets are expected to be implemented in Actor or PageObjects
2627
27- Usage:
2828
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
29+ ## Console
3330
31+ Try to execute test commands in run-time. You may try commands before writing the test.
3432
33+ * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
3534
36- ## GenerateEnvironment
3735
38- Generates empty environment configuration file into envs dir:
3936
40- * ` codecept g:env firefox `
37+ ## GenerateGroup
4138
42- Required to have ` envs ` path to be specified in ` codeception.yml `
39+ Creates empty GroupObject - extension which handles all group events.
4340
41+ * ` codecept g:group Admin `
4442
4543
46- ## CompletionFallback
4744
45+ ## Build
4846
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.
4949
50- ## DryRun
50+ * ` codecept build `
51+ * ` codecept build path/to/project `
5152
52- Shows step by step execution process for scenario driven tests without actually running them.
5353
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 `
5854
5955
56+ ## GenerateSuite
57+
58+ Create new test suite. Requires suite name and actor name
59+
60+ * ``
61+ * ` codecept g:suite api ` -> api + ApiTester
62+ * ` codecept g:suite integration Code ` -> integration + CodeTester
63+ * ` codecept g:suite frontend Front ` -> frontend + FrontTester
64+
65+
66+
67+
68+ ## GenerateSnapshot
69+
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
73+
74+ * ` codecept g:snapshot UserEmails `
75+ * ` codecept g:snapshot Products `
76+ * ` codecept g:snapshot acceptance UserEmails `
77+
78+
79+
80+ ## GenerateScenarios
81+
82+ Generates user-friendly text scenarios from scenario-driven tests (Cest).
83+
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
87+
88+
89+
90+ ## CompletionFallback
91+
6092
6193
6294## GenerateHelper
@@ -69,76 +101,83 @@ Creates empty Helper class.
69101
70102
71103
72- ## GenerateSuite
73-
74- Create new test suite. Requires suite name and actor name
104+ ## GenerateTest
75105
76- * ``
77- * ` codecept g:suite api ` -> api + ApiTester
78- * ` codecept g:suite integration Code ` -> integration + CodeTester
79- * ` codecept g:suite frontend Front ` -> frontend + FrontTester
106+ Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
80107
108+ * ` codecept g:test unit User `
109+ * ` codecept g:test unit "App\User" `
81110
82111
83112
84- ## Build
113+ ## GenerateFeature
85114
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.
115+ Generates Feature file (in Gherkin):
88116
89- * ` codecept build `
90- * ` codecept build path/to/project `
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 `
91120
92121
93122
94123
95- ## GenerateSnapshot
124+ ## GeneratePageObject
96125
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
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.
100128
101- * ` codecept g:snapshot UserEmails `
102- * ` codecept g:snapshot Products `
103- * ` codecept g:snapshot acceptance UserEmails `
129+ * ` codecept g:page Login `
130+ * ` codecept g:page Registration `
131+ * ` codecept g:page acceptance Login `
104132
105133
106134
107- ## Clean
135+ ## Bootstrap
108136
109- Recursively cleans ` output ` directory and generated code.
137+ Creates default config, tests directory and sample suites for current project.
138+ Use this command to start building a test suite.
110139
111- * ` codecept clean `
140+ By default it will create 3 suites ** Acceptance ** , ** Functional ** , and ** Unit ** .
112141
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
113147
114148
115149
116- ## Console
117150
118- Try to execute test commands in run-time. You may try commands before writing the test.
151+ ## GenerateEnvironment
119152
120- * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
153+ Generates empty environment configuration file into envs dir:
121154
155+ * ` codecept g:env firefox `
122156
157+ Required to have ` envs ` path to be specified in ` codeception.yml `
123158
124- ## GenerateStepObject
125159
126- Generates StepObject class. You will be asked for steps you want to implement.
127160
128- * ` codecept g:stepobject acceptance AdminSteps `
129- * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
161+ ## ConfigValidate
130162
163+ Validates and prints Codeception config.
164+ Use it do debug Yaml configs
131165
166+ Check config:
132167
168+ * ` codecept config ` : check global config
169+ * ` codecept config unit ` : check suite config
133170
134- ## GherkinSteps
171+ Load config:
135172
136- Prints all steps from all Gherkin contexts for a specific suite
173+ * ` codecept config:validate -c path/to/another/config ` : from another dir
174+ * ` codecept config:validate -c another_config.yml ` : from another config file
137175
138- {% highlight yaml %}
139- codecept gherkin: steps acceptance
176+ Check overriding config values (like in ` run ` command)
140177
141- {% endhighlight %}
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
142181
143182
144183
@@ -231,104 +270,65 @@ Options:
231270
232271
233272
234- ## GeneratePageObject
235273
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.
238-
239- * ` codecept g:page Login `
240- * ` codecept g:page Registration `
241- * ` codecept g:page acceptance Login `
242-
243-
244-
245- ## GenerateFeature
246-
247- Generates Feature file (in Gherkin):
248-
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 `
252-
253-
254-
255-
256- ## GenerateGroup
257-
258- Creates empty GroupObject - extension which handles all group events.
259-
260- * ` codecept g:group Admin `
261-
262-
263-
264- ## GenerateScenarios
265-
266- Generates user-friendly text scenarios from scenario-driven tests (Cest).
274+ ## GherkinSnippets
267275
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
276+ Generates code snippets for matched feature files in a suite.
277+ Code snippets are expected to be implemented in Actor or PageObjects
271278
279+ Usage:
272280
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
273285
274286
275- ## GenerateTest
276287
277- Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
288+ ## SelfUpdate
278289
279- * ` codecept g:test unit User `
280- * ` codecept g:test unit "App\User" `
290+ Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar ' .
281291
292+ * ` php codecept.phar self-update `
282293
294+ @author Franck Cassedanne < franck@cassedanne.com >
283295
284- ## GenerateCest
285296
286- Generates Cest (scenario-driven object-oriented test) file:
287297
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" `
298+ ## Init
292299
293300
294301
302+ ## GherkinSteps
295303
296- ## Bootstrap
304+ Prints all steps from all Gherkin contexts for a specific suite
297305
298- Creates default config, tests directory and sample suites for current project.
299- Use this command to start building a test suite.
306+ {% highlight yaml %}
307+ codecept gherkin : steps acceptance
300308
301- By default it will create 3 suites ** Acceptance ** , ** Functional ** , and ** Unit ** .
309+ {% endhighlight %}
302310
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
308311
309312
310313
314+ ## GenerateStepObject
311315
312- ## ConfigValidate
316+ Generates StepObject class. You will be asked for steps you want to implement.
313317
314- Validates and prints Codeception config.
315- Use it do debug Yaml configs
318+ * ` codecept g:stepobject acceptance AdminSteps `
319+ * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
316320
317- Check config:
318321
319- * ` codecept config ` : check global config
320- * ` codecept config unit ` : check suite config
321322
322- Load config:
323323
324- * ` codecept config:validate -c path/to/another/config ` : from another dir
325- * ` codecept config:validate -c another_config.yml ` : from another config file
324+ ## DryRun
326325
327- Check overriding config values (like in ` run ` command)
326+ Shows step by step execution process for scenario driven tests without actually running them.
328327
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
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 `
332332
333333
334334
0 commit comments