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