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