@@ -5,61 +5,6 @@ title: Commands - Codeception - Documentation
5
5
6
6
# Console Commands
7
7
8
- ## GeneratePageObject
9
-
10
- Generates PageObject. Can be generated either globally, or just for one suite.
11
- If PageObject is generated globally it will act as UIMap, without any logic in it.
12
-
13
- * ` codecept g:page Login `
14
- * ` codecept g:page Registration `
15
- * ` codecept g:page acceptance Login `
16
-
17
-
18
-
19
- ## GherkinSnippets
20
-
21
- Generates code snippets for matched feature files in a suite.
22
- Code snippets are expected to be implemented in Actor or PageObjects
23
-
24
- Usage:
25
-
26
- * ` codecept gherkin:snippets acceptance ` - snippets from all feature of acceptance tests
27
- * ` codecept gherkin:snippets acceptance/feature/users ` - snippets from ` feature/users ` dir of acceptance tests
28
- * ` codecept gherkin:snippets acceptance user_account.feature ` - snippets from a single feature file
29
- * ` codecept gherkin:snippets acceptance/feature/users/user_accout.feature ` - snippets from feature file in a dir
30
-
31
-
32
-
33
- ## Console
34
-
35
- Try to execute test commands in run-time. You may try commands before writing the test.
36
-
37
- * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
38
-
39
-
40
-
41
- ## GenerateSnapshot
42
-
43
- Generates Snapshot.
44
- Snapshot can be used to test dynamical data.
45
- If suite name is provided, an actor class will be included into placeholder
46
-
47
- * ` codecept g:snapshot UserEmails `
48
- * ` codecept g:snapshot Products `
49
- * ` codecept g:snapshot acceptance UserEmails `
50
-
51
-
52
-
53
- ## GenerateHelper
54
-
55
- Creates empty Helper class.
56
-
57
- * ` codecept g:helper MyHelper `
58
- * ` codecept g:helper "My\Helper" `
59
-
60
-
61
-
62
-
63
8
## Run
64
9
65
10
Executes tests.
@@ -148,6 +93,16 @@ Options:
148
93
149
94
150
95
96
+ ## GenerateScenarios
97
+
98
+ Generates user-friendly text scenarios from scenario-driven tests (Cest).
99
+
100
+ * ` codecept g:scenarios acceptance ` - for all acceptance tests
101
+ * ` codecept g:scenarios acceptance --format html ` - in html format
102
+ * ` codecept g:scenarios acceptance --path doc ` - generate scenarios to ` doc ` dir
103
+
104
+
105
+
151
106
## Bootstrap
152
107
153
108
Creates default config, tests directory and sample suites for current project.
@@ -164,21 +119,32 @@ By default it will create 3 suites **Acceptance**, **Functional**, and **Unit**.
164
119
165
120
166
121
167
- ## SelfUpdate
122
+ ## Build
168
123
169
- Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar ' .
124
+ Generates Actor classes (initially Guy classes) from suite configs.
125
+ Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
170
126
171
- * ` php codecept.phar self-update `
127
+ * ` codecept build `
128
+ * ` codecept build path/to/project `
172
129
173
- @author Franck Cassedanne
< [email protected] >
174
130
175
131
176
132
177
- ## GenerateGroup
133
+ ## GenerateTest
178
134
179
- Creates empty GroupObject - extension which handles all group events .
135
+ Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
180
136
181
- * ` codecept g:group Admin `
137
+ * ` codecept g:test unit User `
138
+ * ` codecept g:test unit "App\User" `
139
+
140
+
141
+
142
+ ## GenerateHelper
143
+
144
+ Creates empty Helper class.
145
+
146
+ * ` codecept g:helper MyHelper `
147
+ * ` codecept g:helper "My\Helper" `
182
148
183
149
184
150
@@ -195,27 +161,59 @@ codecept gherkin:steps acceptance
195
161
196
162
197
163
198
- ## Init
164
+ ## GenerateSuite
199
165
166
+ Create new test suite. Requires suite name and actor name
200
167
168
+ * ``
169
+ * ` codecept g:suite api ` -> api + ApiTester
170
+ * ` codecept g:suite integration Code ` -> integration + CodeTester
171
+ * ` codecept g:suite frontend Front ` -> frontend + FrontTester
201
172
202
- ## GenerateEnvironment
203
173
204
- Generates empty environment configuration file into envs dir:
205
174
206
- * ` codecept g:env firefox `
207
175
208
- Required to have ` envs ` path to be specified in ` codeception.yml `
176
+ ## GenerateSnapshot
209
177
178
+ Generates Snapshot.
179
+ Snapshot can be used to test dynamical data.
180
+ If suite name is provided, an actor class will be included into placeholder
210
181
182
+ * ` codecept g:snapshot UserEmails `
183
+ * ` codecept g:snapshot Products `
184
+ * ` codecept g:snapshot acceptance UserEmails `
211
185
212
- ## GenerateScenarios
213
186
214
- Generates user-friendly text scenarios from scenario-driven tests (Cest).
215
187
216
- * ` codecept g:scenarios acceptance ` - for all acceptance tests
217
- * ` codecept g:scenarios acceptance --format html ` - in html format
218
- * ` codecept g:scenarios acceptance --path doc ` - generate scenarios to ` doc ` dir
188
+ ## GenerateGroup
189
+
190
+ Creates empty GroupObject - extension which handles all group events.
191
+
192
+ * ` codecept g:group Admin `
193
+
194
+
195
+
196
+ ## GherkinSnippets
197
+
198
+ Generates code snippets for matched feature files in a suite.
199
+ Code snippets are expected to be implemented in Actor or PageObjects
200
+
201
+ Usage:
202
+
203
+ * ` codecept gherkin:snippets acceptance ` - snippets from all feature of acceptance tests
204
+ * ` codecept gherkin:snippets acceptance/feature/users ` - snippets from ` feature/users ` dir of acceptance tests
205
+ * ` codecept gherkin:snippets acceptance user_account.feature ` - snippets from a single feature file
206
+ * ` codecept gherkin:snippets acceptance/feature/users/user_accout.feature ` - snippets from feature file in a dir
207
+
208
+
209
+
210
+ ## SelfUpdate
211
+
212
+ Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar ' .
213
+
214
+ * ` php codecept.phar self-update `
215
+
216
+ @author Franck Cassedanne
< [email protected] >
219
217
220
218
221
219
@@ -229,59 +227,58 @@ Generates StepObject class. You will be asked for steps you want to implement.
229
227
230
228
231
229
232
- ## GenerateTest
230
+ ## Console
233
231
234
- Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
232
+ Try to execute test commands in run-time. You may try commands before writing the test .
235
233
236
- * ` codecept g:test unit User `
237
- * ` codecept g:test unit "App\User" `
234
+ * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
238
235
239
236
240
237
241
- ## ConfigValidate
238
+ ## GenerateEnvironment
242
239
243
- Validates and prints Codeception config.
244
- Use it do debug Yaml configs
240
+ Generates empty environment configuration file into envs dir:
245
241
246
- Check config:
242
+ * ` codecept g:env firefox `
247
243
248
- * ` codecept config ` : check global config
249
- * ` codecept config unit ` : check suite config
244
+ Required to have ` envs ` path to be specified in ` codeception.yml `
250
245
251
- Load config:
252
246
253
- * ` codecept config:validate -c path/to/another/config ` : from another dir
254
- * ` codecept config:validate -c another_config.yml ` : from another config file
255
247
256
- Check overriding config values (like in ` run ` command)
248
+ ## Clean
257
249
258
- * ` codecept config:validate -o "settings: shuffle: true" ` : enable shuffle
259
- * ` codecept config:validate -o "settings: lint: false" ` : disable linting
260
- * ` codecept config:validate -o "reporters: report: \Custom\Reporter" --report ` : use custom reporter
250
+ Recursively cleans ` output ` directory and generated code.
261
251
252
+ * ` codecept clean `
262
253
263
254
264
255
265
- ## Build
266
256
267
- Generates Actor classes (initially Guy classes) from suite configs.
268
- Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
257
+ ## GenerateCest
269
258
270
- * ` codecept build `
271
- * ` codecept build path/to/project `
259
+ Generates Cest (scenario-driven object-oriented test) file:
272
260
261
+ * ` codecept generate:cest suite Login `
262
+ * ` codecept g:cest suite subdir/subdir/testnameCest.php `
263
+ * ` codecept g:cest suite LoginCest -c path/to/project `
264
+ * ` codecept g:cest "App\Login" `
273
265
274
266
275
267
276
- ## GenerateSuite
277
268
278
- Create new test suite. Requires suite name and actor name
279
269
280
- * ``
281
- * ` codecept g:suite api ` -> api + ApiTester
282
- * ` codecept g:suite integration Code ` -> integration + CodeTester
283
- * ` codecept g:suite frontend Front ` -> frontend + FrontTester
270
+ ## GeneratePageObject
284
271
272
+ Generates PageObject. Can be generated either globally, or just for one suite.
273
+ If PageObject is generated globally it will act as UIMap, without any logic in it.
274
+
275
+ * ` codecept g:page Login `
276
+ * ` codecept g:page Registration `
277
+ * ` codecept g:page acceptance Login `
278
+
279
+
280
+
281
+ ## Init
285
282
286
283
287
284
@@ -296,35 +293,38 @@ Generates Feature file (in Gherkin):
296
293
297
294
298
295
299
- ## DryRun
300
-
301
- Shows step by step execution process for scenario driven tests without actually running them.
296
+ ## ConfigValidate
302
297
303
- * ` codecept dry-run acceptance `
304
- * ` codecept dry-run acceptance MyCest `
305
- * ` codecept dry-run acceptance checkout.feature `
306
- * ` codecept dry-run tests/acceptance/MyCest.php `
298
+ Validates and prints Codeception config.
299
+ Use it do debug Yaml configs
307
300
301
+ Check config:
308
302
303
+ * ` codecept config ` : check global config
304
+ * ` codecept config unit ` : check suite config
309
305
306
+ Load config:
310
307
311
- ## Clean
308
+ * ` codecept config:validate -c path/to/another/config ` : from another dir
309
+ * ` codecept config:validate -c another_config.yml ` : from another config file
312
310
313
- Recursively cleans ` output ` directory and generated code.
311
+ Check overriding config values (like in ` run ` command)
314
312
315
- * ` codecept clean `
313
+ * ` codecept config:validate -o "settings: shuffle: true" ` : enable shuffle
314
+ * ` codecept config:validate -o "settings: lint: false" ` : disable linting
315
+ * ` codecept config:validate -o "reporters: report: \Custom\Reporter" --report ` : use custom reporter
316
316
317
317
318
318
319
319
320
- ## GenerateCest
320
+ ## DryRun
321
321
322
- Generates Cest ( scenario- driven object-oriented test) file:
322
+ Shows step by step execution process for scenario driven tests without actually running them.
323
323
324
- * ` codecept generate:cest suite Login `
325
- * ` codecept g:cest suite subdir/subdir/testnameCest.php `
326
- * ` codecept g:cest suite LoginCest -c path/to/project `
327
- * ` codecept g:cest "App\Login" `
324
+ * ` codecept dry-run acceptance `
325
+ * ` codecept dry-run acceptance MyCest `
326
+ * ` codecept dry-run acceptance checkout.feature `
327
+ * ` codecept dry-run tests/acceptance/MyCest.php `
328
328
329
329
330
330
0 commit comments