@@ -5,65 +5,22 @@ title: Commands - Codeception - Documentation
5
5
6
6
# Console Commands
7
7
8
- ## Build
9
-
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.
12
-
13
- * ` codecept build `
14
- * ` codecept build path/to/project `
15
-
16
-
17
-
18
-
19
- ## Bootstrap
20
-
21
- Creates default config, tests directory and sample suites for current project.
22
- Use this command to start building a test suite.
23
-
24
- By default it will create 3 suites ** Acceptance** , ** Functional** , and ** Unit** .
25
-
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
-
8
+ ## SelfUpdate
48
9
49
- ## GenerateFeature
10
+ Auto-updates phar archive from official site: ' https://codeception.com/codecept.phar ' .
50
11
51
- Generates Feature file (in Gherkin):
12
+ * ` php codecept.phar self-update `
52
13
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 `
14
+ @author Franck Cassedanne
< [email protected] >
56
15
57
16
58
17
59
18
60
- ## GenerateScenarios
19
+ ## GenerateGroup
61
20
62
- Generates user-friendly text scenarios from scenario-driven tests (Cest) .
21
+ Creates empty GroupObject - extension which handles all group events .
63
22
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
23
+ * ` codecept g:group Admin `
67
24
68
25
69
26
@@ -91,70 +48,58 @@ Check overriding config values (like in `run` command)
91
48
92
49
93
50
94
- ## GenerateTest
95
-
96
- Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
97
-
98
- * ` codecept g:test unit User `
99
- * ` codecept g:test unit "App\User" `
100
-
101
-
102
-
103
- ## GenerateSuite
51
+ ## CompletionFallback
104
52
105
- Create new test suite. Requires suite name and actor name
106
53
107
- * ``
108
- * ` codecept g:suite api ` -> api + ApiTester
109
- * ` codecept g:suite integration Code ` -> integration + CodeTester
110
- * ` codecept g:suite frontend Front ` -> frontend + FrontTester
111
54
55
+ ## Console
112
56
57
+ Try to execute test commands in run-time. You may try commands before writing the test.
113
58
59
+ * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
114
60
115
- ## GenerateStepObject
116
61
117
- Generates StepObject class. You will be asked for steps you want to implement.
118
62
119
- * ` codecept g:stepobject acceptance AdminSteps `
120
- * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
63
+ ## Build
121
64
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.
122
67
68
+ * ` codecept build `
69
+ * ` codecept build path/to/project `
123
70
124
71
125
- ## GeneratePageObject
126
72
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.
129
73
130
- * ` codecept g:page Login `
131
- * ` codecept g:page Registration `
132
- * ` codecept g:page acceptance Login `
74
+ ## GherkinSteps
133
75
76
+ Prints all steps from all Gherkin contexts for a specific suite
134
77
78
+ {% highlight yaml %}
79
+ codecept gherkin: steps acceptance
135
80
136
- ## Console
81
+ {% endhighlight %}
137
82
138
- Try to execute test commands in run-time. You may try commands before writing the test.
139
83
140
- * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
141
84
142
85
86
+ ## GenerateFeature
143
87
144
- ## CompletionFallback
88
+ Generates Feature file (in Gherkin):
145
89
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 `
146
93
147
94
148
- ## DryRun
149
95
150
- Shows step by step execution process for scenario driven tests without actually running them.
151
96
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 `
97
+ ## GenerateTest
156
98
99
+ Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
157
100
101
+ * ` codecept g:test unit User `
102
+ * ` codecept g:test unit "App\User" `
158
103
159
104
160
105
@@ -246,43 +191,85 @@ Options:
246
191
247
192
248
193
249
- ## GherkinSteps
194
+ ## GeneratePageObject
250
195
251
- Prints all steps from all Gherkin contexts for a specific suite
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.
252
198
253
- {% highlight yaml %}
254
- codecept gherkin: steps acceptance
199
+ * ` codecept g:page Login `
200
+ * ` codecept g:page Registration `
201
+ * ` codecept g:page acceptance Login `
255
202
256
- {% endhighlight %}
257
203
258
204
205
+ ## Clean
259
206
207
+ Recursively cleans ` output ` directory and generated code.
260
208
261
- ## GenerateEnvironment
209
+ * ` codecept clean `
262
210
263
- Generates empty environment configuration file into envs dir:
264
211
265
- * ` codecept g:env firefox `
266
212
267
- Required to have ` envs ` path to be specified in ` codeception.yml `
268
213
214
+ ## GenerateStepObject
269
215
216
+ Generates StepObject class. You will be asked for steps you want to implement.
270
217
271
- ## GenerateGroup
218
+ * ` codecept g:stepobject acceptance AdminSteps `
219
+ * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
272
220
273
- Creates empty GroupObject - extension which handles all group events.
274
221
275
- * ` codecept g:group Admin `
276
222
277
223
224
+ ## GherkinSnippets
278
225
279
- ## SelfUpdate
226
+ Generates code snippets for matched feature files in a suite.
227
+ Code snippets are expected to be implemented in Actor or PageObjects
228
+
229
+ Usage:
230
+
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
235
+
236
+
237
+
238
+ ## GenerateCest
239
+
240
+ Generates Cest (scenario-driven object-oriented test) file:
241
+
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" `
280
246
281
- Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar ' .
282
247
283
- * ` php codecept.phar self-update `
284
248
285
- @author Franck Cassedanne
< [email protected] >
249
+
250
+ ## Bootstrap
251
+
252
+ Creates default config, tests directory and sample suites for current project.
253
+ Use this command to start building a test suite.
254
+
255
+ By default it will create 3 suites ** Acceptance** , ** Functional** , and ** Unit** .
256
+
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
262
+
263
+
264
+
265
+
266
+ ## GenerateScenarios
267
+
268
+ Generates user-friendly text scenarios from scenario-driven tests (Cest).
269
+
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
286
273
287
274
288
275
@@ -296,16 +283,29 @@ Creates empty Helper class.
296
283
297
284
298
285
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
+
299
298
## Init
300
299
301
300
302
301
303
- ## Clean
302
+ ## GenerateEnvironment
304
303
305
- Recursively cleans ` output ` directory and generated code.
304
+ Generates empty environment configuration file into envs dir:
306
305
307
- * ` codecept clean `
306
+ * ` codecept g:env firefox `
308
307
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
- ## GenerateCest
324
+ ## DryRun
325
325
326
- Generates Cest ( scenario- driven object-oriented test) file:
326
+ Shows step by step execution process for scenario driven tests without actually running them.
327
327
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" `
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