@@ -5,25 +5,12 @@ title: Commands - Codeception - Documentation
5
5
6
6
# Console Commands
7
7
8
- ## DryRun
9
-
10
- Shows step-by-step execution process for scenario driven tests without actually running them.
11
-
12
- * ` codecept dry-run acceptance `
13
- * ` codecept dry-run acceptance MyCest `
14
- * ` codecept dry-run acceptance checkout.feature `
15
- * ` codecept dry-run tests/acceptance/MyCest.php `
16
-
17
-
18
-
19
-
20
- ## Build
8
+ ## GenerateStepObject
21
9
22
- Generates Actor classes (initially Guy classes) from suite configs.
23
- Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
10
+ Generates StepObject class. You will be asked for steps you want to implement.
24
11
25
- * ` codecept build `
26
- * ` codecept build path/to/project `
12
+ * ` codecept g:stepobject acceptance AdminSteps `
13
+ * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
27
14
28
15
29
16
@@ -38,93 +25,36 @@ Generates user-friendly text scenarios from scenario-driven tests (Cest).
38
25
39
26
40
27
28
+ ## GenerateSnapshot
41
29
42
- ## ConfigValidate
43
-
44
- Validates and prints Codeception config.
45
- Use it do debug Yaml configs
46
-
47
- Check config:
48
-
49
- * ` codecept config ` : check global config
50
- * ` codecept config unit ` : check suite config
51
-
52
- Load config:
53
-
54
- * ` codecept config:validate -c path/to/another/config ` : from another dir
55
- * ` codecept config:validate -c another_config.yml ` : from another config file
56
-
57
- Check overriding config values (like in ` run ` command)
58
-
59
- * ` codecept config:validate -o "settings: shuffle: true" ` : enable shuffle
60
- * ` codecept config:validate -o "settings: lint: false" ` : disable linting
61
- * ` codecept config:validate -o "reporters: report: \Custom\Reporter" --report ` : use custom reporter
62
-
63
-
64
-
65
-
66
- ## GenerateFeature
67
-
68
- Generates Feature file (in Gherkin):
69
-
70
- * ` codecept generate:feature suite Login `
71
- * ` codecept g:feature suite subdir/subdir/login.feature `
72
- * ` codecept g:feature suite login.feature -c path/to/project `
73
-
74
-
75
-
76
-
77
- ## GherkinSteps
78
-
79
- Prints all steps from all Gherkin contexts for a specific suite
80
-
81
- {% highlight yaml %}
82
- codecept gherkin: steps acceptance
83
-
84
- {% endhighlight %}
85
-
86
-
87
-
88
-
89
- ## GeneratePageObject
90
-
91
- Generates PageObject. Can be generated either globally, or just for one suite.
92
- If PageObject is generated globally it will act as UIMap, without any logic in it.
93
-
94
- * ` codecept g:page Login `
95
- * ` codecept g:page Registration `
96
- * ` codecept g:page acceptance Login `
97
-
98
-
99
-
100
- ## GenerateEnvironment
101
-
102
- Generates empty environment configuration file into envs dir:
103
-
104
- * ` codecept g:env firefox `
105
-
106
- Required to have ` envs ` path to be specified in ` codeception.yml `
30
+ Generates Snapshot.
31
+ Snapshot can be used to test dynamical data.
32
+ If suite name is provided, an actor class will be included into placeholder
107
33
34
+ * ` codecept g:snapshot UserEmails `
35
+ * ` codecept g:snapshot Products `
36
+ * ` codecept g:snapshot acceptance UserEmails `
108
37
109
38
110
- ## GenerateCest
111
39
112
- Generates Cest (scenario-driven object-oriented test) file:
40
+ ## DryRun
113
41
114
- * ` codecept generate:cest suite Login `
115
- * ` codecept g:cest suite subdir/subdir/testnameCest.php `
116
- * ` codecept g:cest suite LoginCest -c path/to/project `
117
- * ` codecept g:cest "App\Login" `
42
+ Shows step-by-step execution process for scenario driven tests without actually running them.
118
43
44
+ * ` codecept dry-run acceptance `
45
+ * ` codecept dry-run acceptance MyCest `
46
+ * ` codecept dry-run acceptance checkout.feature `
47
+ * ` codecept dry-run tests/acceptance/MyCest.php `
119
48
120
49
121
50
122
- ## Clean
123
51
124
- Recursively cleans ` output ` directory and generated code.
52
+ ## GenerateTest
125
53
126
- * ` codecept clean `
54
+ Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
127
55
56
+ * ` codecept g:test unit User `
57
+ * ` codecept g:test unit "App\User" `
128
58
129
59
130
60
@@ -138,42 +68,6 @@ Creates empty Helper class.
138
68
139
69
140
70
141
- ## GenerateSuite
142
-
143
- Create new test suite. Requires suite name and actor name
144
-
145
- * ``
146
- * ` codecept g:suite api ` -> api + ApiTester
147
- * ` codecept g:suite integration Code ` -> integration + CodeTester
148
- * ` codecept g:suite frontend Front ` -> frontend + FrontTester
149
-
150
-
151
-
152
-
153
- ## Console
154
-
155
- Try to execute test commands in run-time. You may try commands before writing the test.
156
-
157
- * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
158
-
159
-
160
-
161
- ## GenerateSnapshot
162
-
163
- Generates Snapshot.
164
- Snapshot can be used to test dynamical data.
165
- If suite name is provided, an actor class will be included into placeholder
166
-
167
- * ` codecept g:snapshot UserEmails `
168
- * ` codecept g:snapshot Products `
169
- * ` codecept g:snapshot acceptance UserEmails `
170
-
171
-
172
-
173
- ## Init
174
-
175
-
176
-
177
71
## GherkinSnippets
178
72
179
73
Generates code snippets for matched feature files in a suite.
@@ -188,42 +82,24 @@ Usage:
188
82
189
83
190
84
191
- ## GenerateStepObject
192
-
193
- Generates StepObject class. You will be asked for steps you want to implement.
194
-
195
- * ` codecept g:stepobject acceptance AdminSteps `
196
- * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
197
-
198
-
199
-
200
-
201
- ## CompletionFallback
202
-
203
-
204
-
205
- ## GenerateTest
206
-
207
- Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
85
+ ## GeneratePageObject
208
86
209
- * ` codecept g:test unit User `
210
- * ` codecept g:test unit "App\User" `
87
+ Generates PageObject. Can be generated either globally, or just for one suite.
88
+ If PageObject is generated globally it will act as UIMap, without any logic in it.
211
89
90
+ * ` codecept g:page Login `
91
+ * ` codecept g:page Registration `
92
+ * ` codecept g:page acceptance Login `
212
93
213
94
214
- ## Bootstrap
215
95
216
- Creates default config, tests directory and sample suites for current project.
217
- Use this command to start building a test suite.
96
+ ## GenerateEnvironment
218
97
219
- By default, it will create 3 suites ** Acceptance ** , ** Functional ** , and ** Unit ** .
98
+ Generates empty environment configuration file into envs dir:
220
99
221
- * ` codecept bootstrap ` - creates ` tests ` dir and ` codeception.yml ` in current dir.
222
- * ` codecept bootstrap --empty ` - creates ` tests ` dir without suites
223
- * ` codecept bootstrap --namespace Frontend ` - creates tests, and use ` Frontend ` namespace for actor classes and helpers.
224
- * ` codecept bootstrap --actor Wizard ` - sets actor as Wizard, to have ` TestWizard ` actor in tests.
225
- * ` codecept bootstrap path/to/the/project ` - provide different path to a project, where tests should be placed
100
+ * ` codecept g:env firefox `
226
101
102
+ Required to have ` envs ` path to be specified in ` codeception.yml `
227
103
228
104
229
105
@@ -316,6 +192,75 @@ Options:
316
192
317
193
318
194
195
+ ## CompletionFallback
196
+
197
+
198
+
199
+ ## GherkinSteps
200
+
201
+ Prints all steps from all Gherkin contexts for a specific suite
202
+
203
+ {% highlight yaml %}
204
+ codecept gherkin: steps acceptance
205
+
206
+ {% endhighlight %}
207
+
208
+
209
+
210
+
211
+ ## Clean
212
+
213
+ Recursively cleans ` output ` directory and generated code.
214
+
215
+ * ` codecept clean `
216
+
217
+
218
+
219
+
220
+ ## Init
221
+
222
+
223
+
224
+ ## GenerateCest
225
+
226
+ Generates Cest (scenario-driven object-oriented test) file:
227
+
228
+ * ` codecept generate:cest suite Login `
229
+ * ` codecept g:cest suite subdir/subdir/testnameCest.php `
230
+ * ` codecept g:cest suite LoginCest -c path/to/project `
231
+ * ` codecept g:cest "App\Login" `
232
+
233
+
234
+
235
+
236
+ ## Console
237
+
238
+ Try to execute test commands in run-time. You may try commands before writing the test.
239
+
240
+ * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
241
+
242
+
243
+
244
+ ## GenerateSuite
245
+
246
+ Create new test suite. Requires suite name and actor name
247
+
248
+ * ``
249
+ * ` codecept g:suite api ` -> api + ApiTester
250
+ * ` codecept g:suite integration Code ` -> integration + CodeTester
251
+ * ` codecept g:suite frontend Front ` -> frontend + FrontTester
252
+
253
+
254
+
255
+
256
+ ## GenerateGroup
257
+
258
+ Creates empty GroupObject - extension which handles all group events.
259
+
260
+ * ` codecept g:group Admin `
261
+
262
+
263
+
319
264
## SelfUpdate
320
265
321
266
Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar ' .
@@ -326,11 +271,66 @@ Auto-updates phar archive from official site: 'https://codeception.com/codecept.
326
271
327
272
328
273
329
- ## GenerateGroup
274
+ ## Build
275
+
276
+ Generates Actor classes (initially Guy classes) from suite configs.
277
+ Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
278
+
279
+ * ` codecept build `
280
+ * ` codecept build path/to/project `
281
+
282
+
283
+
284
+
285
+ ## GenerateFeature
286
+
287
+ Generates Feature file (in Gherkin):
288
+
289
+ * ` codecept generate:feature suite Login `
290
+ * ` codecept g:feature suite subdir/subdir/login.feature `
291
+ * ` codecept g:feature suite login.feature -c path/to/project `
292
+
293
+
294
+
295
+
296
+ ## Bootstrap
297
+
298
+ Creates default config, tests directory and sample suites for current project.
299
+ Use this command to start building a test suite.
300
+
301
+ By default, it will create 3 suites ** Acceptance** , ** Functional** , and ** Unit** .
302
+
303
+ * ` codecept bootstrap ` - creates ` tests ` dir and ` codeception.yml ` in current dir.
304
+ * ` codecept bootstrap --empty ` - creates ` tests ` dir without suites
305
+ * ` codecept bootstrap --namespace Frontend ` - creates tests, and use ` Frontend ` namespace for actor classes and helpers.
306
+ * ` codecept bootstrap --actor Wizard ` - sets actor as Wizard, to have ` TestWizard ` actor in tests.
307
+ * ` codecept bootstrap path/to/the/project ` - provide different path to a project, where tests should be placed
308
+
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
330
332
331
- Creates empty GroupObject - extension which handles all group events.
332
333
333
- * ` codecept g:group Admin `
334
334
335
335
336
336
0 commit comments