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