@@ -5,214 +5,171 @@ title: Commands - Codeception - Documentation
55
66# Console Commands
77
8- ## ConfigValidate
9-
10- Validates and prints Codeception config.
11- Use it do debug Yaml configs
12-
13- Check config:
14-
15- * ` codecept config ` : check global config
16- * ` codecept config unit ` : check suite config
17-
18- Load config:
19-
20- * ` codecept config:validate -c path/to/another/config ` : from another dir
21- * ` codecept config:validate -c another_config.yml ` : from another config file
22-
23- Check overriding config values (like in ` run ` command)
24-
25- * ` codecept config:validate -o "settings: shuffle: true" ` : enable shuffle
26- * ` codecept config:validate -o "settings: lint: false" ` : disable linting
27- * ` codecept config:validate -o "reporters: report: \Custom\Reporter" --report ` : use custom reporter
28-
29-
30-
31-
32- ## GenerateCest
33-
34- Generates Cest (scenario-driven object-oriented test) file:
35-
36- * ` codecept generate:cest suite Login `
37- * ` codecept g:cest suite subdir/subdir/testnameCest.php `
38- * ` codecept g:cest suite LoginCest -c path/to/project `
39- * ` codecept g:cest "App\Login" `
40-
41-
42-
43-
44- ## Build
45-
46- Generates Actor classes (initially Guy classes) from suite configs.
47- Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
48-
49- * ` codecept build `
50- * ` codecept build path/to/project `
8+ ## GenerateStepObject
519
10+ Generates StepObject class. You will be asked for steps you want to implement.
5211
12+ * ` codecept g:stepobject acceptance AdminSteps `
13+ * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
5314
5415
55- ## GenerateSnapshot
5616
57- Generates Snapshot.
58- Snapshot can be used to test dynamical data.
59- If suite name is provided, an actor class will be included into placeholder
6017
61- * ` codecept g:snapshot UserEmails `
62- * ` codecept g:snapshot Products `
63- * ` codecept g:snapshot acceptance UserEmails `
18+ ## GenerateFeature
6419
20+ Generates Feature file (in Gherkin):
6521
22+ * ` codecept generate:feature suite Login `
23+ * ` codecept g:feature suite subdir/subdir/login.feature `
24+ * ` codecept g:feature suite login.feature -c path/to/project `
6625
67- ## GenerateHelper
6826
69- Creates empty Helper class.
7027
71- * ` codecept g:helper MyHelper `
72- * ` codecept g:helper "My\Helper" `
7328
29+ ## Console
7430
31+ Try to execute test commands in run-time. You may try commands before writing the test.
7532
33+ * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
7634
77- ## Bootstrap
7835
79- Creates default config, tests directory and sample suites for current project.
80- Use this command to start building a test suite.
8136
82- By default it will create 3 suites ** acceptance ** , ** functional ** , and ** unit ** .
37+ ## GeneratePageObject
8338
84- * ` codecept bootstrap ` - creates ` tests ` dir and ` codeception.yml ` in current dir.
85- * ` codecept bootstrap --empty ` - creates ` tests ` dir without suites
86- * ` codecept bootstrap --namespace Frontend ` - creates tests, and use ` Frontend ` namespace for actor classes and helpers.
87- * ` codecept bootstrap --actor Wizard ` - sets actor as Wizard, to have ` TestWizard ` actor in tests.
88- * ` codecept bootstrap path/to/the/project ` - provide different path to a project, where tests should be placed
39+ Generates PageObject. Can be generated either globally, or just for one suite.
40+ If PageObject is generated globally it will act as UIMap, without any logic in it.
8941
42+ * ` codecept g:page Login `
43+ * ` codecept g:page Registration `
44+ * ` codecept g:page acceptance Login `
9045
9146
9247
93- ## GenerateTest
9448
95- Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
49+ ## GherkinSnippets
9650
97- * ` codecept g:test unit User `
98- * ` codecept g:test unit "App\User" `
51+ Generates code snippets for matched feature files in a suite.
52+ Code snippets are expected to be implemented in Actor or PageObjects
9953
54+ Usage:
10055
56+ * ` codecept gherkin:snippets acceptance ` - snippets from all feature of acceptance tests
57+ * ` codecept gherkin:snippets acceptance/feature/users ` - snippets from ` feature/users ` dir of acceptance tests
58+ * ` codecept gherkin:snippets acceptance user_account.feature ` - snippets from a single feature file
59+ * ` codecept gherkin:snippets acceptance/feature/users/user_accout.feature ` - snippets from feature file in a dir
10160
102- ## GenerateStepObject
10361
104- Generates StepObject class. You will be asked for steps you want to implement.
10562
106- * ` codecept g:stepobject acceptance AdminSteps `
107- * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
63+ ## Clean
10864
65+ Recursively cleans ` output ` directory and generated code.
10966
67+ * ` codecept clean `
11068
11169
112- ## GenerateFeature
11370
114- Generates Feature file (in Gherkin):
11571
116- * ` codecept generate:feature suite Login `
117- * ` codecept g:feature suite subdir/subdir/login.feature `
118- * ` codecept g:feature suite login.feature -c path/to/project `
72+ ## GenerateGroup
11973
74+ Creates empty GroupObject - extension which handles all group events.
12075
76+ * ` codecept g:group Admin `
12177
12278
123- ## GenerateSuite
12479
125- Create new test suite. Requires suite name and actor name
80+ ## DryRun
12681
127- * ``
128- * ` codecept g:suite api ` -> api + ApiTester
129- * ` codecept g:suite integration Code ` -> integration + CodeTester
130- * ` codecept g:suite frontend Front ` -> frontend + FrontTester
82+ Shows step by step execution process for scenario driven tests without actually running them.
13183
84+ * ` codecept dry-run acceptance `
85+ * ` codecept dry-run acceptance MyCest `
86+ * ` codecept dry-run acceptance checkout.feature `
87+ * ` codecept dry-run tests/acceptance/MyCest.php `
13288
13389
13490
135- ## SelfUpdate
13691
137- Auto-updates phar archive from official site: ' https://codeception.com/codecept.phar ' .
92+ ## GenerateTest
13893
139- * ` php codecept.phar self-update `
94+ Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
14095
141- @author Franck Cassedanne < franck@cassedanne.com >
96+ * ` codecept g:test unit User `
97+ * ` codecept g:test unit "App\User" `
14298
14399
144100
145- ## GenerateEnvironment
101+ ## GenerateSnapshot
146102
147- Generates empty environment configuration file into envs dir:
103+ Generates Snapshot.
104+ Snapshot can be used to test dynamical data.
105+ If suite name is provided, an actor class will be included into placeholder
148106
149- * ` codecept g:env firefox `
107+ * ` codecept g:snapshot UserEmails `
108+ * ` codecept g:snapshot Products `
109+ * ` codecept g:snapshot acceptance UserEmails `
150110
151- Required to have ` envs ` path to be specified in ` codeception.yml `
152111
153112
113+ ## GenerateScenarios
154114
155- ## DryRun
115+ Generates user-friendly text scenarios from scenario-driven tests (Cest).
156116
157- Shows step by step execution process for scenario driven tests without actually running them.
117+ * ` codecept g:scenarios acceptance ` - for all acceptance tests
118+ * ` codecept g:scenarios acceptance --format html ` - in html format
119+ * ` codecept g:scenarios acceptance --path doc ` - generate scenarios to ` doc ` dir
158120
159- * ` codecept dry-run acceptance `
160- * ` codecept dry-run acceptance MyCest `
161- * ` codecept dry-run acceptance checkout.feature `
162- * ` codecept dry-run tests/acceptance/MyCest.php `
163121
164122
123+ ## GenerateHelper
165124
125+ Creates empty Helper class.
166126
167- ## Init
127+ * ` codecept g:helper MyHelper `
128+ * ` codecept g:helper "My\Helper" `
168129
169130
170131
171132
172- ## GenerateScenarios
133+ ## GenerateCest
173134
174- Generates user-friendly text scenarios from scenario-driven tests (Cest).
135+ Generates Cest ( scenario-driven object-oriented test) file:
175136
176- * ` codecept g:scenarios acceptance ` - for all acceptance tests
177- * ` codecept g:scenarios acceptance --format html ` - in html format
178- * ` codecept g:scenarios acceptance --path doc ` - generate scenarios to ` doc ` dir
137+ * ` codecept generate:cest suite Login `
138+ * ` codecept g:cest suite subdir/subdir/testnameCest.php `
139+ * ` codecept g:cest suite LoginCest -c path/to/project `
140+ * ` codecept g:cest "App\Login" `
179141
180142
181143
182- ## CompletionFallback
183144
145+ ## Build
184146
147+ Generates Actor classes (initially Guy classes) from suite configs.
148+ Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
185149
186- ## GeneratePageObject
150+ * ` codecept build `
151+ * ` codecept build path/to/project `
187152
188- Generates PageObject. Can be generated either globally, or just for one suite.
189- If PageObject is generated globally it will act as UIMap, without any logic in it.
190153
191- * ` codecept g:page Login `
192- * ` codecept g:page Registration `
193- * ` codecept g:page acceptance Login `
194154
195155
156+ ## SelfUpdate
196157
197- ## Console
158+ Auto-updates phar archive from official site: ' https://codeception.com/codecept.phar ' .
198159
199- Try to execute test commands in run-time. You may try commands before writing the test.
160+ * ` php codecept.phar self-update `
200161
201- * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
162+ @ author Franck Cassedanne < franck@cassedanne.com >
202163
203164
204165
205- ## GherkinSnippets
166+ ## GenerateEnvironment
206167
207- Generates code snippets for matched feature files in a suite.
208- Code snippets are expected to be implemented in Actor or PageObjects
168+ Generates empty environment configuration file into envs dir:
209169
210- Usage:
170+ * ` codecept g:env firefox `
211171
212- * ` codecept gherkin:snippets acceptance ` - snippets from all feature of acceptance tests
213- * ` codecept gherkin:snippets acceptance/feature/users ` - snippets from ` feature/users ` dir of acceptance tests
214- * ` codecept gherkin:snippets acceptance user_account.feature ` - snippets from a single feature file
215- * ` codecept gherkin:snippets acceptance/feature/users/user_accout.feature ` - snippets from feature file in a dir
172+ Required to have ` envs ` path to be specified in ` codeception.yml `
216173
217174
218175
@@ -304,20 +261,19 @@ Options:
304261
305262
306263
307- ## Clean
308-
309- Recursively cleans ` output ` directory and generated code.
310-
311- * ` codecept clean `
264+ ## CompletionFallback
312265
313266
314267
268+ ## GenerateSuite
315269
316- ## GenerateGroup
270+ Create new test suite. Requires suite name and actor name
317271
318- Creates empty GroupObject - extension which handles all group events.
272+ * ``
273+ * ` codecept g:suite api ` -> api + ApiTester
274+ * ` codecept g:suite integration Code ` -> integration + CodeTester
275+ * ` codecept g:suite frontend Front ` -> frontend + FrontTester
319276
320- * ` codecept g:group Admin `
321277
322278
323279
@@ -333,3 +289,47 @@ codecept gherkin:steps acceptance
333289
334290
335291
292+ ## Bootstrap
293+
294+ Creates default config, tests directory and sample suites for current project.
295+ Use this command to start building a test suite.
296+
297+ By default it will create 3 suites ** acceptance** , ** functional** , and ** unit** .
298+
299+ * ` codecept bootstrap ` - creates ` tests ` dir and ` codeception.yml ` in current dir.
300+ * ` codecept bootstrap --empty ` - creates ` tests ` dir without suites
301+ * ` codecept bootstrap --namespace Frontend ` - creates tests, and use ` Frontend ` namespace for actor classes and helpers.
302+ * ` codecept bootstrap --actor Wizard ` - sets actor as Wizard, to have ` TestWizard ` actor in tests.
303+ * ` codecept bootstrap path/to/the/project ` - provide different path to a project, where tests should be placed
304+
305+
306+
307+
308+ ## Init
309+
310+
311+
312+ ## ConfigValidate
313+
314+ Validates and prints Codeception config.
315+ Use it do debug Yaml configs
316+
317+ Check config:
318+
319+ * ` codecept config ` : check global config
320+ * ` codecept config unit ` : check suite config
321+
322+ Load config:
323+
324+ * ` codecept config:validate -c path/to/another/config ` : from another dir
325+ * ` codecept config:validate -c another_config.yml ` : from another config file
326+
327+ Check overriding config values (like in ` run ` command)
328+
329+ * ` codecept config:validate -o "settings: shuffle: true" ` : enable shuffle
330+ * ` codecept config:validate -o "settings: lint: false" ` : disable linting
331+ * ` codecept config:validate -o "reporters: report: \Custom\Reporter" --report ` : use custom reporter
332+
333+
334+
335+
0 commit comments