@@ -5,11 +5,70 @@ title: Commands - Codeception - Documentation
55
66# Console Commands
77
8+ ## GherkinSteps
9+
10+ Prints all steps from all Gherkin contexts for a specific suite
11+
12+ {% highlight yaml %}
13+ codecept gherkin: steps acceptance
14+
15+ {% endhighlight %}
16+
17+
18+
19+
20+ ## DryRun
21+
22+ Shows step-by-step execution process for scenario driven tests without actually running them.
23+
24+ * ` codecept dry-run acceptance `
25+ * ` codecept dry-run acceptance MyCest `
26+ * ` codecept dry-run acceptance checkout.feature `
27+ * ` codecept dry-run tests/acceptance/MyCest.php `
28+
29+
30+
31+
832## Init
933
1034
1135
12- ## CompletionFallback
36+ ## GenerateCest
37+
38+ Generates Cest (scenario-driven object-oriented test) file:
39+
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" `
44+
45+
46+
47+
48+ ## SelfUpdate
49+
50+ Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar ' .
51+
52+ * ` php codecept.phar self-update `
53+
54+ @author Franck Cassedanne
< [email protected] > 55+
56+
57+
58+ ## GenerateTest
59+
60+ Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
61+
62+ * ` codecept g:test unit User `
63+ * ` codecept g:test unit "App\User" `
64+
65+
66+
67+ ## GenerateGroup
68+
69+ Creates empty GroupObject - extension which handles all group events.
70+
71+ * ` codecept g:group Admin `
1372
1473
1574
@@ -102,102 +161,50 @@ Options:
102161
103162
104163
105- ## Clean
106-
107- Recursively cleans ` output ` directory and generated code.
108-
109- * ` codecept clean `
110-
111-
112-
113-
114- ## Console
115-
116- Try to execute test commands in run-time. You may try commands before writing the test.
117-
118- * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
119-
120-
121-
122- ## GenerateGroup
123-
124- Creates empty GroupObject - extension which handles all group events.
125-
126- * ` codecept g:group Admin `
127-
128-
129-
130- ## GherkinSnippets
131-
132- Generates code snippets for matched feature files in a suite.
133- Code snippets are expected to be implemented in Actor or PageObjects
134-
135- Usage:
136-
137- * ` codecept gherkin:snippets acceptance ` - snippets from all feature of acceptance tests
138- * ` codecept gherkin:snippets acceptance/feature/users ` - snippets from ` feature/users ` dir of acceptance tests
139- * ` codecept gherkin:snippets acceptance user_account.feature ` - snippets from a single feature file
140- * ` codecept gherkin:snippets acceptance/feature/users/user_accout.feature ` - snippets from feature file in a dir
141-
142-
143-
144- ## GenerateCest
145-
146- Generates Cest (scenario-driven object-oriented test) file:
147-
148- * ` codecept generate:cest suite Login `
149- * ` codecept g:cest suite subdir/subdir/testnameCest.php `
150- * ` codecept g:cest suite LoginCest -c path/to/project `
151- * ` codecept g:cest "App\Login" `
152-
153-
154-
164+ ## CompletionFallback
155165
156- ## Bootstrap
157166
158- Creates default config, tests directory and sample suites for current project.
159- Use this command to start building a test suite.
160167
161- By default, it will create 3 suites ** Acceptance ** , ** Functional ** , and ** Unit ** .
168+ ## GenerateStepObject
162169
163- * ` codecept bootstrap ` - creates ` tests ` dir and ` codeception.yml ` in current dir.
164- * ` codecept bootstrap --empty ` - creates ` tests ` dir without suites
165- * ` codecept bootstrap --namespace Frontend ` - creates tests, and use ` Frontend ` namespace for actor classes and helpers.
166- * ` codecept bootstrap --actor Wizard ` - sets actor as Wizard, to have ` TestWizard ` actor in tests.
167- * ` codecept bootstrap path/to/the/project ` - provide different path to a project, where tests should be placed
170+ Generates StepObject class. You will be asked for steps you want to implement.
168171
172+ * ` codecept g:stepobject acceptance AdminSteps `
173+ * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
169174
170175
171176
172- ## GenerateFeature
173177
174- Generates Feature file (in Gherkin):
178+ ## GenerateSnapshot
175179
176- * ` codecept generate:feature suite Login `
177- * ` codecept g:feature suite subdir/subdir/login.feature `
178- * ` codecept g:feature suite login.feature -c path/to/project `
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
179183
184+ * ` codecept g:snapshot UserEmails `
185+ * ` codecept g:snapshot Products `
186+ * ` codecept g:snapshot acceptance UserEmails `
180187
181188
182189
183- ## GenerateTest
190+ ## GenerateScenarios
184191
185- Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
192+ Generates user-friendly text scenarios from scenario-driven tests (Cest) .
186193
187- * ` codecept g:test unit User `
188- * ` codecept g:test unit "App\User" `
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
189197
190198
191199
192- ## GenerateSnapshot
200+ ## GeneratePageObject
193201
194- Generates Snapshot.
195- Snapshot can be used to test dynamical data.
196- If suite name is provided, an actor class will be included into placeholder
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.
197204
198- * ` codecept g:snapshot UserEmails `
199- * ` codecept g:snapshot Products `
200- * ` codecept g:snapshot acceptance UserEmails `
205+ * ` codecept g:page Login `
206+ * ` codecept g:page Registration `
207+ * ` codecept g:page acceptance Login `
201208
202209
203210
@@ -225,111 +232,104 @@ Check overriding config values (like in `run` command)
225232
226233
227234
228- ## GenerateSuite
229-
230- Create new test suite. Requires suite name and actor name
231-
232- * ``
233- * ` codecept g:suite api ` -> api + ApiTester
234- * ` codecept g:suite integration Code ` -> integration + CodeTester
235- * ` codecept g:suite frontend Front ` -> frontend + FrontTester
236-
237-
238-
235+ ## GenerateHelper
239236
240- ## GherkinSteps
237+ Creates empty Helper class.
241238
242- Prints all steps from all Gherkin contexts for a specific suite
239+ * ` codecept g:helper MyHelper `
240+ * ` codecept g:helper "My\Helper" `
243241
244- {% highlight yaml %}
245- codecept gherkin: steps acceptance
246242
247- {% endhighlight %}
248243
249244
245+ ## Bootstrap
250246
247+ Creates default config, tests directory and sample suites for current project.
248+ Use this command to start building a test suite.
251249
252- ## Build
250+ By default, it will create 3 suites ** Acceptance ** , ** Functional ** , and ** Unit ** .
253251
254- Generates Actor classes (initially Guy classes) from suite configs.
255- Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
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
256257
257- * ` codecept build `
258- * ` codecept build path/to/project `
259258
260259
261260
261+ ## GenerateEnvironment
262262
263- ## DryRun
263+ Generates empty environment configuration file into envs dir:
264264
265- Shows step-by-step execution process for scenario driven tests without actually running them.
265+ * ` codecept g:env firefox `
266266
267- * ` codecept dry-run acceptance `
268- * ` codecept dry-run acceptance MyCest `
269- * ` codecept dry-run acceptance checkout.feature `
270- * ` codecept dry-run tests/acceptance/MyCest.php `
267+ Required to have ` envs ` path to be specified in ` codeception.yml `
271268
272269
273270
271+ ## Console
274272
275- ## GenerateScenarios
273+ Try to execute test commands in run-time. You may try commands before writing the test.
276274
277- Generates user-friendly text scenarios from scenario-driven tests (Cest) .
275+ * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands .
278276
279- * ` codecept g:scenarios acceptance ` - for all acceptance tests
280- * ` codecept g:scenarios acceptance --format html ` - in html format
281- * ` codecept g:scenarios acceptance --path doc ` - generate scenarios to ` doc ` dir
282277
283278
279+ ## GenerateSuite
284280
285- ## GenerateEnvironment
281+ Create new test suite. Requires suite name and actor name
286282
287- Generates empty environment configuration file into envs dir:
283+ * ``
284+ * ` codecept g:suite api ` -> api + ApiTester
285+ * ` codecept g:suite integration Code ` -> integration + CodeTester
286+ * ` codecept g:suite frontend Front ` -> frontend + FrontTester
288287
289- * ` codecept g:env firefox `
290288
291- Required to have ` envs ` path to be specified in ` codeception.yml `
292289
293290
291+ ## Build
294292
295- ## GeneratePageObject
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.
296295
297- Generates PageObject. Can be generated either globally, or just for one suite.
298- If PageObject is generated globally it will act as UIMap, without any logic in it.
296+ * ` codecept build `
297+ * ` codecept build path/to/project `
299298
300- * ` codecept g:page Login `
301- * ` codecept g:page Registration `
302- * ` codecept g:page acceptance Login `
303299
304300
305301
306- ## GenerateHelper
302+ ## Clean
307303
308- Creates empty Helper class .
304+ Recursively cleans ` output ` directory and generated code .
309305
310- * ` codecept g:helper MyHelper `
311- * ` codecept g:helper "My\Helper" `
306+ * ` codecept clean `
312307
313308
314309
315310
316311
317- ## SelfUpdate
312+ ## GherkinSnippets
318313
319- Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar ' .
314+ Generates code snippets for matched feature files in a suite.
315+ Code snippets are expected to be implemented in Actor or PageObjects
320316
321- * ` php codecept.phar self-update `
317+ Usage:
322318
323- @author Franck Cassedanne
< [email protected] > 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
324323
325324
326325
327- ## GenerateStepObject
326+ ## GenerateFeature
328327
329- Generates StepObject class. You will be asked for steps you want to implement.
328+ Generates Feature file (in Gherkin):
330329
331- * ` codecept g:stepobject acceptance AdminSteps `
332- * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
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