@@ -5,41 +5,65 @@ title: Commands - Codeception - Documentation
55
66# Console Commands
77
8- ## SelfUpdate
8+ ## GenerateStepObject
99
10- Auto-updates phar archive from official site: ' https://codeception.com/codecept.phar ' .
10+ Generates StepObject class. You will be asked for steps you want to implement .
1111
12- * ` php codecept.phar self-update `
12+ * ` codecept g:stepobject Acceptance AdminSteps `
13+ * ` codecept g:stepobject Acceptance UserSteps --silent ` - skip action questions
1314
14- @author Franck Cassedanne < franck@cassedanne.com >
1515
1616
1717
18- ## Init
18+ ## GenerateHelper
1919
20+ Creates empty Helper class.
2021
22+ * ` codecept g:helper MyHelper `
23+ * ` codecept g:helper "My\Helper" `
2124
22- ## GherkinSteps
2325
24- Prints all steps from all Gherkin contexts for a specific suite
2526
26- {% highlight yaml %}
27- codecept gherkin: steps Acceptance
27+ ## GenerateGroup
2828
29- {% endhighlight %}
29+ Creates empty GroupObject - extension which handles all group events.
3030
31+ * ` codecept g:group Admin `
3132
3233
33- ## CompletionFallback
3434
35+ ## GherkinSnippets
3536
37+ Generates code snippets for matched feature files in a suite.
38+ Code snippets are expected to be implemented in Actor or PageObjects
3639
37- ## GenerateHelper
40+ Usage:
3841
39- Creates empty Helper class.
42+ * ` codecept gherkin:snippets Acceptance ` - snippets from all feature of acceptance tests
43+ * ` codecept gherkin:snippets Acceptance/feature/users ` - snippets from ` feature/users ` dir of acceptance tests
44+ * ` codecept gherkin:snippets Acceptance user_account.feature ` - snippets from a single feature file
45+ * ` codecept gherkin:snippets Acceptance/feature/users/user_accout.feature ` - snippets from feature file in a dir
46+
47+
48+
49+ ## Clean
50+
51+ Recursively cleans ` output ` directory and generated code.
52+
53+ * ` codecept clean `
54+
55+
56+
57+
58+ ## Console
59+
60+ Try to execute test commands in run-time. You may try commands before writing the test.
61+
62+ * ` codecept console Acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
4063
41- * ` codecept g:helper MyHelper `
42- * ` codecept g:helper "My\Helper" `
64+
65+
66+ ## CompletionFallback
4367
4468
4569
@@ -55,17 +79,26 @@ If suite name is provided, an actor class will be included into placeholder
5579
5680
5781
58- ## GherkinSnippets
5982
60- Generates code snippets for matched feature files in a suite.
61- Code snippets are expected to be implemented in Actor or PageObjects
83+ ## GenerateScenarios
6284
63- Usage:
85+ Generates user-friendly text scenarios from scenario-driven tests (Cest).
86+
87+ * ` codecept g:scenarios Acceptance ` - for all acceptance tests
88+ * ` codecept g:scenarios Acceptance --format html ` - in html format
89+ * ` codecept g:scenarios Acceptance --path doc ` - generate scenarios to ` doc ` dir
90+
91+
92+
93+ ## GenerateCest
94+
95+ Generates Cest (scenario-driven object-oriented test) file:
96+
97+ * ` codecept generate:cest suite Login `
98+ * ` codecept g:cest suite subdir/subdir/testnameCest.php `
99+ * ` codecept g:cest suite LoginCest -c path/to/project `
100+ * ` codecept g:cest "App\Login" `
64101
65- * ` codecept gherkin:snippets Acceptance ` - snippets from all feature of acceptance tests
66- * ` codecept gherkin:snippets Acceptance/feature/users ` - snippets from ` feature/users ` dir of acceptance tests
67- * ` codecept gherkin:snippets Acceptance user_account.feature ` - snippets from a single feature file
68- * ` codecept gherkin:snippets Acceptance/feature/users/user_accout.feature ` - snippets from feature file in a dir
69102
70103
71104
@@ -162,86 +195,88 @@ Options:
162195
163196
164197
165- ## Clean
198+ ## Bootstrap
166199
167- Recursively cleans ` output ` directory and generated code.
200+ Creates default config, tests directory and sample suites for current project.
201+ Use this command to start building a test suite.
168202
169- * ` codecept clean `
203+ By default, it will create 3 suites ** Acceptance ** , ** Functional ** , and ** Unit ** .
170204
205+ * ` codecept bootstrap ` - creates ` tests ` dir and ` codeception.yml ` in current dir.
206+ * ` codecept bootstrap --empty ` - creates ` tests ` dir without suites
207+ * ` codecept bootstrap --namespace Frontend ` - creates tests, and use ` Frontend ` namespace for actor classes and helpers.
208+ * ` codecept bootstrap --actor Wizard ` - sets actor as Wizard, to have ` TestWizard ` actor in tests.
209+ * ` codecept bootstrap path/to/the/project ` - provide different path to a project, where tests should be placed
171210
172211
173212
174- ## Build
175213
176- Generates Actor classes (initially Guy classes) from suite configs.
177- Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
214+ ## GeneratePageObject
178215
179- * ` codecept build `
180- * ` codecept build path/to/project `
216+ Generates PageObject. Can be generated either globally, or just for one suite.
217+ If PageObject is generated globally it will act as UIMap, without any logic in it.
181218
219+ * ` codecept g:page Login `
220+ * ` codecept g:page Registration `
221+ * ` codecept g:page Acceptance Login `
182222
183223
184224
185- ## GenerateEnvironment
225+ ## Build
186226
187- Generates empty environment configuration file into envs dir:
227+ Generates Actor classes (initially Guy classes) from suite configs.
228+ Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
188229
189- * ` codecept g:env firefox `
230+ * ` codecept build `
231+ * ` codecept build path/to/project `
190232
191- Required to have ` envs ` path to be specified in ` codeception.yml `
192233
193234
194235
195- ## GenerateSuite
236+ ## SelfUpdate
196237
197- Create new test suite. Requires suite name and actor name
238+ Auto-updates phar archive from official site: ' https://codeception.com/codecept.phar ' .
198239
199- * ``
200- * ` codecept g:suite Api ` -> api + ApiTester
201- * ` codecept g:suite Integration Code ` -> integration + CodeTester
202- * ` codecept g:suite Frontend Front ` -> frontend + FrontTester
240+ * ` php codecept.phar self-update `
203241
242+ @author Franck Cassedanne < franck@cassedanne.com >
204243
205244
206245
207- ## GenerateGroup
246+ ## GherkinSteps
208247
209- Creates empty GroupObject - extension which handles all group events.
248+ Prints all steps from all Gherkin contexts for a specific suite
210249
211- * ` codecept g:group Admin `
250+ {% highlight yaml %}
251+ codecept gherkin: steps Acceptance
212252
253+ {% endhighlight %}
213254
214255
215- ## GenerateScenarios
216256
217- Generates user-friendly text scenarios from scenario-driven tests (Cest).
257+ ## GenerateSuite
218258
219- * ` codecept g:scenarios Acceptance ` - for all acceptance tests
220- * ` codecept g:scenarios Acceptance --format html ` - in html format
221- * ` codecept g:scenarios Acceptance --path doc ` - generate scenarios to ` doc ` dir
259+ Create new test suite. Requires suite name and actor name
222260
261+ * ``
262+ * ` codecept g:suite Api ` -> api + ApiTester
263+ * ` codecept g:suite Integration Code ` -> integration + CodeTester
264+ * ` codecept g:suite Frontend Front ` -> frontend + FrontTester
223265
224266
225- ## DryRun
226267
227- Shows step-by-step execution process for scenario driven tests without actually running them.
228268
229- * ` codecept dry-run Acceptance `
230- * ` codecept dry-run Acceptance MyCest `
231- * ` codecept dry-run Acceptance checkout.feature `
232- * ` codecept dry-run tests/Acceptance/MyCest.php `
269+ ## GenerateEnvironment
233270
271+ Generates empty environment configuration file into envs dir:
234272
273+ * ` codecept g:env firefox `
235274
275+ Required to have ` envs ` path to be specified in ` codeception.yml `
236276
237- ## GeneratePageObject
238277
239- Generates PageObject. Can be generated either globally, or just for one suite.
240- If PageObject is generated globally it will act as UIMap, without any logic in it.
241278
242- * ` codecept g:page Login `
243- * ` codecept g:page Registration `
244- * ` codecept g:page Acceptance Login `
279+ ## Init
245280
246281
247282
@@ -254,33 +289,14 @@ Generates skeleton for Unit Test that extends `Codeception\TestCase\Test`.
254289
255290
256291
257- ## Console
258-
259- Try to execute test commands in run-time. You may try commands before writing the test.
260-
261- * ` codecept console Acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
262-
263-
264-
265-
266- ## GenerateStepObject
267-
268- Generates StepObject class. You will be asked for steps you want to implement.
269-
270- * ` codecept g:stepobject Acceptance AdminSteps `
271- * ` codecept g:stepobject Acceptance UserSteps --silent ` - skip action questions
272-
273-
274-
275-
276- ## GenerateCest
292+ ## DryRun
277293
278- Generates Cest ( scenario- driven object-oriented test) file:
294+ Shows step-by-step execution process for scenario driven tests without actually running them.
279295
280- * ` codecept generate:cest suite Login `
281- * ` codecept g:cest suite subdir/subdir/testnameCest.php `
282- * ` codecept g:cest suite LoginCest -c path/to/project `
283- * ` codecept g:cest "App\Login" `
296+ * ` codecept dry-run Acceptance `
297+ * ` codecept dry-run Acceptance MyCest `
298+ * ` codecept dry-run Acceptance checkout.feature `
299+ * ` codecept dry-run tests/Acceptance/MyCest.php `
284300
285301
286302
@@ -320,19 +336,3 @@ Generates Feature file (in Gherkin):
320336
321337
322338
323- ## Bootstrap
324-
325- Creates default config, tests directory and sample suites for current project.
326- Use this command to start building a test suite.
327-
328- By default, it will create 3 suites ** Acceptance** , ** Functional** , and ** Unit** .
329-
330- * ` codecept bootstrap ` - creates ` tests ` dir and ` codeception.yml ` in current dir.
331- * ` codecept bootstrap --empty ` - creates ` tests ` dir without suites
332- * ` codecept bootstrap --namespace Frontend ` - creates tests, and use ` Frontend ` namespace for actor classes and helpers.
333- * ` codecept bootstrap --actor Wizard ` - sets actor as Wizard, to have ` TestWizard ` actor in tests.
334- * ` codecept bootstrap path/to/the/project ` - provide different path to a project, where tests should be placed
335-
336-
337-
338-
0 commit comments