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