@@ -5,16 +5,78 @@ title: Commands - Codeception - Documentation
55
66# Console Commands
77
8- ## GenerateCest
8+ ## Console
99
10- Generates Cest (scenario-driven object-oriented test) file:
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
1138
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" `
1639
1740
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+
75+
76+
77+
78+ ## CompletionFallback
79+
1880
1981
2082## Run
@@ -105,134 +167,135 @@ Options:
105167
106168
107169
108- ## GenerateHelper
170+ ## GenerateStepObject
109171
110- Creates empty Helper class.
172+ Generates StepObject class. You will be asked for steps you want to implement .
111173
112- * ` codecept g:helper MyHelper `
113- * ` codecept g:helper "My\Helper" `
174+ * ` codecept g:stepobject acceptance AdminSteps `
175+ * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
114176
115177
116178
117179
118- ## ConfigValidate
119180
120- Validates and prints Codeception config.
121- Use it do debug Yaml configs
181+ ## GherkinSteps
122182
123- Check config:
183+ Prints all steps from all Gherkin contexts for a specific suite
124184
125- * ` codecept config ` : check global config
126- * ` codecept config unit ` : check suite config
185+ {% highlight yaml %}
186+ codecept gherkin : steps acceptance
127187
128- Load config:
188+ {% endhighlight %}
129189
130- * ` codecept config:validate -c path/to/another/config ` : from another dir
131- * ` codecept config:validate -c another_config.yml ` : from another config file
132190
133- Check overriding config values (like in ` run ` command)
134191
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
138192
193+ ## GenerateCest
194+
195+ Generates Cest (scenario-driven object-oriented test) file:
139196
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" `
140201
141202
142203
143- ## Console
144204
145- Try to execute test commands in run-time. You may try commands before writing the test.
205+ ## GenerateSnapshot
146206
147- * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
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
148210
211+ * ` codecept g:snapshot UserEmails `
212+ * ` codecept g:snapshot Products `
213+ * ` codecept g:snapshot acceptance UserEmails `
149214
150215
151- ## Build
152216
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.
217+ ## GenerateHelper
155218
156- * ` codecept build `
157- * ` codecept build path/to/project `
219+ Creates empty Helper class.
158220
221+ * ` codecept g:helper MyHelper `
222+ * ` codecept g:helper "My\Helper" `
159223
160224
161225
162- ## Bootstrap
163226
164- Creates default config, tests directory and sample suites for current project.
165- Use this command to start building a test suite.
227+ ## GenerateFeature
166228
167- By default it will create 3 suites ** acceptance ** , ** functional ** , and ** unit ** .
229+ Generates Feature file (in Gherkin):
168230
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
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 `
174234
175235
176236
177237
178- ## Clean
238+ ## Build
179239
180- Recursively cleans ` output ` directory and generated code.
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.
181242
182- * ` codecept clean `
243+ * ` codecept build `
244+ * ` codecept build path/to/project `
183245
184246
185247
186248
187- ## GherkinSnippets
249+ ## GenerateTest
188250
189- Generates code snippets for matched feature files in a suite.
190- Code snippets are expected to be implemented in Actor or PageObjects
251+ Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
191252
192- Usage:
253+ * ` codecept g:test unit User `
254+ * ` codecept g:test unit "App\User" `
193255
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
198256
199257
258+ ## GenerateEnvironment
200259
201- ## DryRun
260+ Generates empty environment configuration file into envs dir:
202261
203- Shows step by step execution process for scenario driven tests without actually running them.
262+ * ` codecept g:env firefox `
204263
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 `
264+ Required to have ` envs ` path to be specified in ` codeception.yml `
209265
210266
211267
268+ ## ConfigValidate
212269
213- ## Init
270+ Validates and prints Codeception config.
271+ Use it do debug Yaml configs
214272
273+ Check config:
215274
275+ * ` codecept config ` : check global config
276+ * ` codecept config unit ` : check suite config
216277
217- ## GherkinSteps
278+ Load config:
218279
219- Prints all steps from all Gherkin contexts for a specific suite
280+ * ` codecept config:validate -c path/to/another/config ` : from another dir
281+ * ` codecept config:validate -c another_config.yml ` : from another config file
220282
221- {% highlight yaml %}
222- codecept gherkin: steps acceptance
283+ Check overriding config values (like in ` run ` command)
223284
224- {% endhighlight %}
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
225288
226289
227290
228291
229- ## GenerateScenarios
292+ ## SelfUpdate
230293
231- Generates user-friendly text scenarios from scenario-driven tests (Cest) .
294+ Auto-updates phar archive from official site: ' https://codeception.com/codecept.phar ' .
232295
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
296+ * ` php codecept.phar self-update `
297+
298+ @ author Franck Cassedanne < franck@cassedanne.com >
236299
237300
238301
@@ -244,64 +307,17 @@ Creates empty GroupObject - extension which handles all group events.
244307
245308
246309
247- ## GenerateFeature
248-
249- Generates Feature file (in Gherkin):
250-
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 `
254-
255-
256-
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 `
310+ ## Init
295311
296312
297313
298- ## SelfUpdate
299-
300- Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar ' .
314+ ## GenerateScenarios
301315
302- * ` php codecept.phar self-update `
316+ Generates user-friendly text scenarios from scenario-driven tests (Cest).
303317
304- @author Franck Cassedanne < franck@cassedanne.com >
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
305321
306322
307323
@@ -317,19 +333,3 @@ Create new test suite. Requires suite name and actor name
317333
318334
319335
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