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