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