@@ -5,77 +5,15 @@ title: Commands - Codeception - Documentation
55
66# Console Commands
77
8- ## Console
9-
10- Try to execute test commands in run-time. You may try commands before writing the test.
11-
12- * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
13-
14-
15-
16- ## GeneratePageObject
17-
18- Generates PageObject. Can be generated either globally, or just for one suite.
19- If PageObject is generated globally it will act as UIMap, without any logic in it.
20-
21- * ` codecept g:page Login `
22- * ` codecept g:page Registration `
23- * ` codecept g:page acceptance Login `
24-
25-
26-
27- ## GherkinSnippets
28-
29- Generates code snippets for matched feature files in a suite.
30- Code snippets are expected to be implemented in Actor or PageObjects
31-
32- Usage:
33-
34- * ` codecept gherkin:snippets acceptance ` - snippets from all feature of acceptance tests
35- * ` codecept gherkin:snippets acceptance/feature/users ` - snippets from ` feature/users ` dir of acceptance tests
36- * ` codecept gherkin:snippets acceptance user_account.feature ` - snippets from a single feature file
37- * ` codecept gherkin:snippets acceptance/feature/users/user_accout.feature ` - snippets from feature file in a dir
38-
39-
40-
41- ## Clean
42-
43- Recursively cleans ` output ` directory and generated code.
44-
45- * ` codecept clean `
46-
47-
48-
49-
50- ## Bootstrap
51-
52- Creates default config, tests directory and sample suites for current project.
53- Use this command to start building a test suite.
54-
55- By default it will create 3 suites ** acceptance** , ** functional** , and ** unit** .
56-
57- * ` codecept bootstrap ` - creates ` tests ` dir and ` codeception.yml ` in current dir.
58- * ` codecept bootstrap --empty ` - creates ` tests ` dir without suites
59- * ` codecept bootstrap --namespace Frontend ` - creates tests, and use ` Frontend ` namespace for actor classes and helpers.
60- * ` codecept bootstrap --actor Wizard ` - sets actor as Wizard, to have ` TestWizard ` actor in tests.
61- * ` codecept bootstrap path/to/the/project ` - provide different path to a project, where tests should be placed
62-
63-
64-
65-
66- ## DryRun
67-
68- Shows step by step execution process for scenario driven tests without actually running them.
69-
70- * ` codecept dry-run acceptance `
71- * ` codecept dry-run acceptance MyCest `
72- * ` codecept dry-run acceptance checkout.feature `
73- * ` codecept dry-run tests/acceptance/MyCest.php `
74-
8+ ## GenerateCest
759
10+ Generates Cest (scenario-driven object-oriented test) file:
7611
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" `
7716
78- ## CompletionFallback
7917
8018
8119
@@ -167,135 +105,134 @@ Options:
167105
168106
169107
170- ## GenerateStepObject
171-
172- Generates StepObject class. You will be asked for steps you want to implement.
173-
174- * ` codecept g:stepobject acceptance AdminSteps `
175- * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
108+ ## GenerateHelper
176109
110+ Creates empty Helper class.
177111
112+ * ` codecept g:helper MyHelper `
113+ * ` codecept g:helper "My\Helper" `
178114
179115
180116
181- ## GherkinSteps
182117
183- Prints all steps from all Gherkin contexts for a specific suite
118+ ## ConfigValidate
184119
185- {% highlight yaml %}
186- codecept gherkin : steps acceptance
120+ Validates and prints Codeception config.
121+ Use it do debug Yaml configs
187122
188- {% endhighlight %}
123+ Check config:
189124
125+ * ` codecept config ` : check global config
126+ * ` codecept config unit ` : check suite config
190127
128+ Load config:
191129
130+ * ` codecept config:validate -c path/to/another/config ` : from another dir
131+ * ` codecept config:validate -c another_config.yml ` : from another config file
192132
193- ## GenerateCest
133+ Check overriding config values (like in ` run ` command)
194134
195- Generates Cest (scenario-driven object-oriented test) file:
135+ * ` codecept config:validate -o "settings: shuffle: true" ` : enable shuffle
136+ * ` codecept config:validate -o "settings: lint: false" ` : disable linting
137+ * ` codecept config:validate -o "reporters: report: \Custom\Reporter" --report ` : use custom reporter
196138
197- * ` codecept generate:cest suite Login `
198- * ` codecept g:cest suite subdir/subdir/testnameCest.php `
199- * ` codecept g:cest suite LoginCest -c path/to/project `
200- * ` codecept g:cest "App\Login" `
201139
202140
203141
204142
205- ## GenerateSnapshot
143+ ## Console
206144
207- Generates Snapshot.
208- Snapshot can be used to test dynamical data.
209- If suite name is provided, an actor class will be included into placeholder
145+ Try to execute test commands in run-time. You may try commands before writing the test.
210146
211- * ` codecept g:snapshot UserEmails `
212- * ` codecept g:snapshot Products `
213- * ` codecept g:snapshot acceptance UserEmails `
147+ * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
214148
215149
216150
217- ## GenerateHelper
151+ ## Build
218152
219- Creates empty Helper class.
153+ Generates Actor classes (initially Guy classes) from suite configs.
154+ Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
220155
221- * ` codecept g:helper MyHelper `
222- * ` codecept g:helper "My\Helper" `
156+ * ` codecept build `
157+ * ` codecept build path/to/project `
223158
224159
225160
226161
227- ## GenerateFeature
162+ ## Bootstrap
228163
229- Generates Feature file (in Gherkin):
164+ Creates default config, tests directory and sample suites for current project.
165+ Use this command to start building a test suite.
230166
231- * ` codecept generate:feature suite Login `
232- * ` codecept g:feature suite subdir/subdir/login.feature `
233- * ` codecept g:feature suite login.feature -c path/to/project `
167+ By default it will create 3 suites ** acceptance** , ** functional** , and ** unit** .
234168
169+ * ` codecept bootstrap ` - creates ` tests ` dir and ` codeception.yml ` in current dir.
170+ * ` codecept bootstrap --empty ` - creates ` tests ` dir without suites
171+ * ` codecept bootstrap --namespace Frontend ` - creates tests, and use ` Frontend ` namespace for actor classes and helpers.
172+ * ` codecept bootstrap --actor Wizard ` - sets actor as Wizard, to have ` TestWizard ` actor in tests.
173+ * ` codecept bootstrap path/to/the/project ` - provide different path to a project, where tests should be placed
235174
236175
237176
238- ## Build
239177
240- Generates Actor classes (initially Guy classes) from suite configs.
241- Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
178+ ## Clean
242179
243- * ` codecept build `
244- * ` codecept build path/to/project `
180+ Recursively cleans ` output ` directory and generated code.
245181
182+ * ` codecept clean `
246183
247184
248185
249- ## GenerateTest
250186
251- Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
187+ ## GherkinSnippets
252188
253- * ` codecept g:test unit User `
254- * ` codecept g:test unit "App\User" `
189+ Generates code snippets for matched feature files in a suite.
190+ Code snippets are expected to be implemented in Actor or PageObjects
255191
192+ Usage:
256193
194+ * ` codecept gherkin:snippets acceptance ` - snippets from all feature of acceptance tests
195+ * ` codecept gherkin:snippets acceptance/feature/users ` - snippets from ` feature/users ` dir of acceptance tests
196+ * ` codecept gherkin:snippets acceptance user_account.feature ` - snippets from a single feature file
197+ * ` codecept gherkin:snippets acceptance/feature/users/user_accout.feature ` - snippets from feature file in a dir
257198
258- ## GenerateEnvironment
259199
260- Generates empty environment configuration file into envs dir:
261200
262- * ` codecept g:env firefox `
201+ ## DryRun
263202
264- Required to have ` envs ` path to be specified in ` codeception.yml `
203+ Shows step by step execution process for scenario driven tests without actually running them.
265204
205+ * ` codecept dry-run acceptance `
206+ * ` codecept dry-run acceptance MyCest `
207+ * ` codecept dry-run acceptance checkout.feature `
208+ * ` codecept dry-run tests/acceptance/MyCest.php `
266209
267210
268- ## ConfigValidate
269211
270- Validates and prints Codeception config.
271- Use it do debug Yaml configs
272212
273- Check config:
213+ ## Init
274214
275- * ` codecept config ` : check global config
276- * ` codecept config unit ` : check suite config
277215
278- Load config:
279216
280- * ` codecept config:validate -c path/to/another/config ` : from another dir
281- * ` codecept config:validate -c another_config.yml ` : from another config file
217+ ## GherkinSteps
282218
283- Check overriding config values (like in ` run ` command)
219+ Prints all steps from all Gherkin contexts for a specific suite
284220
285- * ` codecept config:validate -o "settings: shuffle: true" ` : enable shuffle
286- * ` codecept config:validate -o "settings: lint: false" ` : disable linting
287- * ` codecept config:validate -o "reporters: report: \Custom\Reporter" --report ` : use custom reporter
221+ {% highlight yaml %}
222+ codecept gherkin: steps acceptance
288223
224+ {% endhighlight %}
289225
290226
291227
292- ## SelfUpdate
293228
294- Auto-updates phar archive from official site: ' https://codeception.com/codecept.phar ' .
229+ ## GenerateScenarios
295230
296- * ` php codecept.phar self-update `
231+ Generates user-friendly text scenarios from scenario-driven tests (Cest).
297232
298- @author Franck Cassedanne < franck@cassedanne.com >
233+ * ` codecept g:scenarios acceptance ` - for all acceptance tests
234+ * ` codecept g:scenarios acceptance --format html ` - in html format
235+ * ` codecept g:scenarios acceptance --path doc ` - generate scenarios to ` doc ` dir
299236
300237
301238
@@ -307,17 +244,64 @@ Creates empty GroupObject - extension which handles all group events.
307244
308245
309246
310- ## Init
247+ ## GenerateFeature
311248
249+ Generates Feature file (in Gherkin):
312250
251+ * ` codecept generate:feature suite Login `
252+ * ` codecept g:feature suite subdir/subdir/login.feature `
253+ * ` codecept g:feature suite login.feature -c path/to/project `
313254
314- ## GenerateScenarios
315255
316- Generates user-friendly text scenarios from scenario-driven tests (Cest).
317256
318- * ` codecept g:scenarios acceptance ` - for all acceptance tests
319- * ` codecept g:scenarios acceptance --format html ` - in html format
320- * ` codecept g:scenarios acceptance --path doc ` - generate scenarios to ` doc ` dir
257+
258+ ## GenerateStepObject
259+
260+ Generates StepObject class. You will be asked for steps you want to implement.
261+
262+ * ` codecept g:stepobject acceptance AdminSteps `
263+ * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
264+
265+
266+
267+
268+ ## GenerateEnvironment
269+
270+ Generates empty environment configuration file into envs dir:
271+
272+ * ` codecept g:env firefox `
273+
274+ Required to have ` envs ` path to be specified in ` codeception.yml `
275+
276+
277+
278+ ## GenerateTest
279+
280+ Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
281+
282+ * ` codecept g:test unit User `
283+ * ` codecept g:test unit "App\User" `
284+
285+
286+
287+ ## GeneratePageObject
288+
289+ Generates PageObject. Can be generated either globally, or just for one suite.
290+ If PageObject is generated globally it will act as UIMap, without any logic in it.
291+
292+ * ` codecept g:page Login `
293+ * ` codecept g:page Registration `
294+ * ` codecept g:page acceptance Login `
295+
296+
297+
298+ ## SelfUpdate
299+
300+ Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar ' .
301+
302+ * ` php codecept.phar self-update `
303+
304+ @author Franck Cassedanne < franck@cassedanne.com >
321305
322306
323307
@@ -333,3 +317,19 @@ Create new test suite. Requires suite name and actor name
333317
334318
335319
320+ ## CompletionFallback
321+
322+
323+
324+ ## GenerateSnapshot
325+
326+ Generates Snapshot.
327+ Snapshot can be used to test dynamical data.
328+ If suite name is provided, an actor class will be included into placeholder
329+
330+ * ` codecept g:snapshot UserEmails `
331+ * ` codecept g:snapshot Products `
332+ * ` codecept g:snapshot acceptance UserEmails `
333+
334+
335+
0 commit comments