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