@@ -5,97 +5,64 @@ title: Commands - Codeception - Documentation
5
5
6
6
# Console Commands
7
7
8
- ## ConfigValidate
9
-
10
- Validates and prints Codeception config.
11
- Use it do debug Yaml configs
12
-
13
- Check config:
14
-
15
- * ` codecept config ` : check global config
16
- * ` codecept config unit ` : check suite config
17
-
18
- Load config:
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
-
23
- Check overriding config values (like in ` run ` command)
24
-
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
28
-
29
-
30
-
31
-
32
- ## GenerateCest
33
-
34
- Generates Cest (scenario-driven object-oriented test) file:
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" `
40
-
41
-
8
+ ## Bootstrap
42
9
10
+ Creates default config, tests directory and sample suites for current project.
11
+ Use this command to start building a test suite.
43
12
44
- ## Build
13
+ By default it will create 3 suites ** acceptance ** , ** functional ** , and ** unit ** .
45
14
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.
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
48
20
49
- * ` codecept build `
50
- * ` codecept build path/to/project `
51
21
52
22
53
23
24
+ ## GherkinSteps
54
25
55
- ## GenerateSnapshot
26
+ Prints all steps from all Gherkin contexts for a specific suite
56
27
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
28
+ {% highlight yaml %}
29
+ codecept gherkin: steps acceptance
60
30
61
- * ` codecept g:snapshot UserEmails `
62
- * ` codecept g:snapshot Products `
63
- * ` codecept g:snapshot acceptance UserEmails `
31
+ {% endhighlight %}
64
32
65
33
66
34
67
- ## GenerateHelper
68
35
69
- Creates empty Helper class.
36
+ ## ConfigValidate
70
37
71
- * ` codecept g:helper MyHelper `
72
- * ` codecept g:helper "My\Helper" `
38
+ Validates and prints Codeception config.
39
+ Use it do debug Yaml configs
73
40
41
+ Check config:
74
42
43
+ * ` codecept config ` : check global config
44
+ * ` codecept config unit ` : check suite config
75
45
46
+ Load config:
76
47
77
- ## Bootstrap
48
+ * ` codecept config:validate -c path/to/another/config ` : from another dir
49
+ * ` codecept config:validate -c another_config.yml ` : from another config file
78
50
79
- Creates default config, tests directory and sample suites for current project.
80
- Use this command to start building a test suite.
51
+ Check overriding config values (like in ` run ` command)
81
52
82
- By default it will create 3 suites ** acceptance** , ** functional** , and ** unit** .
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
83
56
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
57
90
58
91
59
60
+ ## Clean
92
61
93
- ## GenerateTest
62
+ Recursively cleans ` output ` directory and generated code.
94
63
95
- Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
64
+ * ` codecept clean `
96
65
97
- * ` codecept g:test unit User `
98
- * ` codecept g:test unit "App\User" `
99
66
100
67
101
68
@@ -109,46 +76,37 @@ Generates StepObject class. You will be asked for steps you want to implement.
109
76
110
77
111
78
112
- ## GenerateFeature
113
-
114
- Generates Feature file (in Gherkin):
115
-
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 `
119
-
120
-
121
-
122
-
123
- ## GenerateSuite
124
-
125
- Create new test suite. Requires suite name and actor name
79
+ ## Build
126
80
127
- * ``
128
- * ` codecept g:suite api ` -> api + ApiTester
129
- * ` codecept g:suite integration Code ` -> integration + CodeTester
130
- * ` codecept g:suite frontend Front ` -> frontend + FrontTester
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.
131
83
84
+ * ` codecept build `
85
+ * ` codecept build path/to/project `
132
86
133
87
134
88
135
- ## SelfUpdate
136
89
137
- Auto-updates phar archive from official site: ' https://codeception.com/codecept.phar ' .
90
+ ## GeneratePageObject
138
91
139
- * ` php codecept.phar self-update `
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.
140
94
141
- @author Franck Cassedanne < franck@cassedanne.com >
95
+ * ` codecept g:page Login `
96
+ * ` codecept g:page Registration `
97
+ * ` codecept g:page acceptance Login `
142
98
143
99
144
100
145
- ## GenerateEnvironment
101
+ ## GenerateCest
146
102
147
- Generates empty environment configuration file into envs dir :
103
+ Generates Cest (scenario-driven object-oriented test) file :
148
104
149
- * ` codecept g:env firefox `
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" `
150
109
151
- Required to have ` envs ` path to be specified in ` codeception.yml `
152
110
153
111
154
112
@@ -164,7 +122,14 @@ Shows step by step execution process for scenario driven tests without actually
164
122
165
123
166
124
167
- ## Init
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
168
133
169
134
170
135
@@ -179,43 +144,6 @@ Generates user-friendly text scenarios from scenario-driven tests (Cest).
179
144
180
145
181
146
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
-
219
147
## Run
220
148
221
149
Executes tests.
@@ -304,12 +232,61 @@ Options:
304
232
305
233
306
234
307
- ## Clean
235
+ ## SelfUpdate
308
236
309
- Recursively cleans ` output ` directory and generated code .
237
+ Auto-updates phar archive from official site: ' https://codeception.com/codecept.phar ' .
310
238
311
- * ` codecept clean `
239
+ * ` php codecept.phar self-update `
312
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
+
280
+
281
+ ## GenerateSnapshot
282
+
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
286
+
287
+ * ` codecept g:snapshot UserEmails `
288
+ * ` codecept g:snapshot Products `
289
+ * ` codecept g:snapshot acceptance UserEmails `
313
290
314
291
315
292
@@ -321,15 +298,38 @@ Creates empty GroupObject - extension which handles all group events.
321
298
322
299
323
300
324
- ## GherkinSteps
301
+ ## GenerateFeature
325
302
326
- Prints all steps from all Gherkin contexts for a specific suite
303
+ Generates Feature file (in Gherkin):
327
304
328
- {% highlight yaml %}
329
- codecept gherkin: steps acceptance
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 `
330
308
331
- {% endhighlight %}
332
309
333
310
334
311
312
+ ## GenerateHelper
313
+
314
+ Creates empty Helper class.
315
+
316
+ * ` codecept g:helper MyHelper `
317
+ * ` codecept g:helper "My\Helper" `
318
+
319
+
320
+
321
+
322
+ ## GherkinSnippets
323
+
324
+ Generates code snippets for matched feature files in a suite.
325
+ Code snippets are expected to be implemented in Actor or PageObjects
326
+
327
+ Usage:
328
+
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
+
334
+
335
335
0 commit comments