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