@@ -5,65 +5,22 @@ title: Commands - Codeception - Documentation
55
66# Console Commands
77
8- ## Build
9-
10- Generates Actor classes (initially Guy classes) from suite configs.
11- Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
12-
13- * ` codecept build `
14- * ` codecept build path/to/project `
15-
16-
17-
18-
19- ## Bootstrap
20-
21- Creates default config, tests directory and sample suites for current project.
22- Use this command to start building a test suite.
23-
24- By default it will create 3 suites ** Acceptance** , ** Functional** , and ** Unit** .
25-
26- * ` codecept bootstrap ` - creates ` tests ` dir and ` codeception.yml ` in current dir.
27- * ` codecept bootstrap --empty ` - creates ` tests ` dir without suites
28- * ` codecept bootstrap --namespace Frontend ` - creates tests, and use ` Frontend ` namespace for actor classes and helpers.
29- * ` codecept bootstrap --actor Wizard ` - sets actor as Wizard, to have ` TestWizard ` actor in tests.
30- * ` codecept bootstrap path/to/the/project ` - provide different path to a project, where tests should be placed
31-
32-
33-
34-
35- ## GherkinSnippets
36-
37- Generates code snippets for matched feature files in a suite.
38- Code snippets are expected to be implemented in Actor or PageObjects
39-
40- Usage:
41-
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-
8+ ## SelfUpdate
489
49- ## GenerateFeature
10+ Auto-updates phar archive from official site: ' https://codeception.com/codecept.phar ' .
5011
51- Generates Feature file (in Gherkin):
12+ * ` php codecept.phar self-update `
5213
53- * ` codecept generate:feature suite Login `
54- * ` codecept g:feature suite subdir/subdir/login.feature `
55- * ` codecept g:feature suite login.feature -c path/to/project `
14+ @author Franck Cassedanne
< [email protected] > 5615
5716
5817
5918
60- ## GenerateScenarios
19+ ## GenerateGroup
6120
62- Generates user-friendly text scenarios from scenario-driven tests (Cest) .
21+ Creates empty GroupObject - extension which handles all group events .
6322
64- * ` codecept g:scenarios acceptance ` - for all acceptance tests
65- * ` codecept g:scenarios acceptance --format html ` - in html format
66- * ` codecept g:scenarios acceptance --path doc ` - generate scenarios to ` doc ` dir
23+ * ` codecept g:group Admin `
6724
6825
6926
@@ -91,70 +48,58 @@ Check overriding config values (like in `run` command)
9148
9249
9350
94- ## GenerateTest
95-
96- Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
97-
98- * ` codecept g:test unit User `
99- * ` codecept g:test unit "App\User" `
100-
101-
102-
103- ## GenerateSuite
51+ ## CompletionFallback
10452
105- Create new test suite. Requires suite name and actor name
10653
107- * ``
108- * ` codecept g:suite api ` -> api + ApiTester
109- * ` codecept g:suite integration Code ` -> integration + CodeTester
110- * ` codecept g:suite frontend Front ` -> frontend + FrontTester
11154
55+ ## Console
11256
57+ Try to execute test commands in run-time. You may try commands before writing the test.
11358
59+ * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
11460
115- ## GenerateStepObject
11661
117- Generates StepObject class. You will be asked for steps you want to implement.
11862
119- * ` codecept g:stepobject acceptance AdminSteps `
120- * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
63+ ## Build
12164
65+ Generates Actor classes (initially Guy classes) from suite configs.
66+ Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
12267
68+ * ` codecept build `
69+ * ` codecept build path/to/project `
12370
12471
125- ## GeneratePageObject
12672
127- Generates PageObject. Can be generated either globally, or just for one suite.
128- If PageObject is generated globally it will act as UIMap, without any logic in it.
12973
130- * ` codecept g:page Login `
131- * ` codecept g:page Registration `
132- * ` codecept g:page acceptance Login `
74+ ## GherkinSteps
13375
76+ Prints all steps from all Gherkin contexts for a specific suite
13477
78+ {% highlight yaml %}
79+ codecept gherkin: steps acceptance
13580
136- ## Console
81+ {% endhighlight %}
13782
138- Try to execute test commands in run-time. You may try commands before writing the test.
13983
140- * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
14184
14285
86+ ## GenerateFeature
14387
144- ## CompletionFallback
88+ Generates Feature file (in Gherkin):
14589
90+ * ` codecept generate:feature suite Login `
91+ * ` codecept g:feature suite subdir/subdir/login.feature `
92+ * ` codecept g:feature suite login.feature -c path/to/project `
14693
14794
148- ## DryRun
14995
150- Shows step by step execution process for scenario driven tests without actually running them.
15196
152- * ` codecept dry-run acceptance `
153- * ` codecept dry-run acceptance MyCest `
154- * ` codecept dry-run acceptance checkout.feature `
155- * ` codecept dry-run tests/acceptance/MyCest.php `
97+ ## GenerateTest
15698
99+ Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
157100
101+ * ` codecept g:test unit User `
102+ * ` codecept g:test unit "App\User" `
158103
159104
160105
@@ -246,43 +191,85 @@ Options:
246191
247192
248193
249- ## GherkinSteps
194+ ## GeneratePageObject
250195
251- Prints all steps from all Gherkin contexts for a specific suite
196+ Generates PageObject. Can be generated either globally, or just for one suite.
197+ If PageObject is generated globally it will act as UIMap, without any logic in it.
252198
253- {% highlight yaml %}
254- codecept gherkin: steps acceptance
199+ * ` codecept g:page Login `
200+ * ` codecept g:page Registration `
201+ * ` codecept g:page acceptance Login `
255202
256- {% endhighlight %}
257203
258204
205+ ## Clean
259206
207+ Recursively cleans ` output ` directory and generated code.
260208
261- ## GenerateEnvironment
209+ * ` codecept clean `
262210
263- Generates empty environment configuration file into envs dir:
264211
265- * ` codecept g:env firefox `
266212
267- Required to have ` envs ` path to be specified in ` codeception.yml `
268213
214+ ## GenerateStepObject
269215
216+ Generates StepObject class. You will be asked for steps you want to implement.
270217
271- ## GenerateGroup
218+ * ` codecept g:stepobject acceptance AdminSteps `
219+ * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
272220
273- Creates empty GroupObject - extension which handles all group events.
274221
275- * ` codecept g:group Admin `
276222
277223
224+ ## GherkinSnippets
278225
279- ## SelfUpdate
226+ Generates code snippets for matched feature files in a suite.
227+ Code snippets are expected to be implemented in Actor or PageObjects
228+
229+ Usage:
230+
231+ * ` codecept gherkin:snippets acceptance ` - snippets from all feature of acceptance tests
232+ * ` codecept gherkin:snippets acceptance/feature/users ` - snippets from ` feature/users ` dir of acceptance tests
233+ * ` codecept gherkin:snippets acceptance user_account.feature ` - snippets from a single feature file
234+ * ` codecept gherkin:snippets acceptance/feature/users/user_accout.feature ` - snippets from feature file in a dir
235+
236+
237+
238+ ## GenerateCest
239+
240+ Generates Cest (scenario-driven object-oriented test) file:
241+
242+ * ` codecept generate:cest suite Login `
243+ * ` codecept g:cest suite subdir/subdir/testnameCest.php `
244+ * ` codecept g:cest suite LoginCest -c path/to/project `
245+ * ` codecept g:cest "App\Login" `
280246
281- Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar ' .
282247
283- * ` php codecept.phar self-update `
284248
285- @author Franck Cassedanne
< [email protected] > 249+
250+ ## Bootstrap
251+
252+ Creates default config, tests directory and sample suites for current project.
253+ Use this command to start building a test suite.
254+
255+ By default it will create 3 suites ** Acceptance** , ** Functional** , and ** Unit** .
256+
257+ * ` codecept bootstrap ` - creates ` tests ` dir and ` codeception.yml ` in current dir.
258+ * ` codecept bootstrap --empty ` - creates ` tests ` dir without suites
259+ * ` codecept bootstrap --namespace Frontend ` - creates tests, and use ` Frontend ` namespace for actor classes and helpers.
260+ * ` codecept bootstrap --actor Wizard ` - sets actor as Wizard, to have ` TestWizard ` actor in tests.
261+ * ` codecept bootstrap path/to/the/project ` - provide different path to a project, where tests should be placed
262+
263+
264+
265+
266+ ## GenerateScenarios
267+
268+ Generates user-friendly text scenarios from scenario-driven tests (Cest).
269+
270+ * ` codecept g:scenarios acceptance ` - for all acceptance tests
271+ * ` codecept g:scenarios acceptance --format html ` - in html format
272+ * ` codecept g:scenarios acceptance --path doc ` - generate scenarios to ` doc ` dir
286273
287274
288275
@@ -296,16 +283,29 @@ Creates empty Helper class.
296283
297284
298285
286+ ## GenerateSuite
287+
288+ Create new test suite. Requires suite name and actor name
289+
290+ * ``
291+ * ` codecept g:suite api ` -> api + ApiTester
292+ * ` codecept g:suite integration Code ` -> integration + CodeTester
293+ * ` codecept g:suite frontend Front ` -> frontend + FrontTester
294+
295+
296+
297+
299298## Init
300299
301300
302301
303- ## Clean
302+ ## GenerateEnvironment
304303
305- Recursively cleans ` output ` directory and generated code.
304+ Generates empty environment configuration file into envs dir:
306305
307- * ` codecept clean `
306+ * ` codecept g:env firefox `
308307
308+ Required to have ` envs ` path to be specified in ` codeception.yml `
309309
310310
311311
@@ -321,14 +321,14 @@ If suite name is provided, an actor class will be included into placeholder
321321
322322
323323
324- ## GenerateCest
324+ ## DryRun
325325
326- Generates Cest ( scenario- driven object-oriented test) file:
326+ Shows step by step execution process for scenario driven tests without actually running them.
327327
328- * ` codecept generate:cest suite Login `
329- * ` codecept g:cest suite subdir/subdir/testnameCest.php `
330- * ` codecept g:cest suite LoginCest -c path/to/project `
331- * ` codecept g:cest "App\Login" `
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