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