@@ -5,24 +5,6 @@ title: Commands - Codeception - Documentation
55
66# Console Commands
77
8- ## GenerateHelper
9-
10- Creates empty Helper class.
11-
12- * ` codecept g:helper MyHelper `
13- * ` codecept g:helper "My\Helper" `
14-
15-
16-
17- ## GenerateTest
18-
19- Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
20-
21- * ` codecept g:test Unit User `
22- * ` codecept g:test Unit "App\User" `
23-
24-
25-
268## Build
279
2810Generates Actor classes (initially Guy classes) from suite configs.
@@ -34,6 +16,14 @@ Starting from Codeception 2.0 actor classes are auto-generated. Use this command
3416
3517
3618
19+ ## Console
20+
21+ Try to execute test commands in run-time. You may try commands before writing the test.
22+
23+ * ` codecept console Acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
24+
25+
26+
3727## GherkinSnippets
3828
3929Generates code snippets for matched feature files in a suite.
@@ -48,30 +38,96 @@ Usage:
4838
4939
5040
51- ## ConfigValidate
41+ ## GenerateSnapshot
5242
53- Validates and prints Codeception config.
54- Use it do debug Yaml configs
43+ Generates Snapshot.
44+ Snapshot can be used to test dynamical data.
45+ If suite name is provided, an actor class will be included into placeholder
5546
56- Check config:
47+ * ` codecept g:snapshot UserEmails `
48+ * ` codecept g:snapshot Products `
49+ * ` codecept g:snapshot Acceptance UserEmails `
5750
58- * ` codecept config ` : check global config
59- * ` codecept config Unit ` : check suite config
6051
61- Load config:
6252
63- * ` codecept config:validate -c path/to/another/config ` : from another dir
64- * ` codecept config:validate -c another_config.yml ` : from another config file
53+ ## GenerateFeature
6554
66- Check overriding config values (like in ` run ` command)
55+ Generates Feature file ( in Gherkin):
6756
68- * ` codecept config:validate -o "settings: shuffle: true" ` : enable shuffle
69- * ` codecept config:validate -o "settings: lint: false" ` : disable linting
70- * ` codecept config:validate -o "reporters: report: \Custom\Reporter" --report ` : use custom reporter
57+ * ` codecept generate:feature suite Login `
58+ * ` codecept g:feature suite subdir/subdir/login.feature `
59+ * ` codecept g:feature suite login.feature -c path/to/project `
7160
7261
7362
7463
64+ ## GherkinSteps
65+
66+ Prints all steps from all Gherkin contexts for a specific suite
67+
68+ {% highlight yaml %}
69+ codecept gherkin: steps Acceptance
70+
71+ {% endhighlight %}
72+
73+
74+
75+ ## CompletionFallback
76+
77+
78+
79+ ## GenerateStepObject
80+
81+ Generates StepObject class. You will be asked for steps you want to implement.
82+
83+ * ` codecept g:stepobject Acceptance AdminSteps `
84+ * ` codecept g:stepobject Acceptance UserSteps --silent ` - skip action questions
85+
86+
87+
88+
89+ ## GenerateHelper
90+
91+ Creates empty Helper class.
92+
93+ * ` codecept g:helper MyHelper `
94+ * ` codecept g:helper "My\Helper" `
95+
96+
97+
98+
99+ ## GenerateEnvironment
100+
101+ Generates empty environment configuration file into envs dir:
102+
103+ * ` codecept g:env firefox `
104+
105+ Required to have ` envs ` path to be specified in ` codeception.yml `
106+
107+
108+
109+ ## DryRun
110+
111+ Shows step-by-step execution process for scenario driven tests without actually running them.
112+
113+ * ` codecept dry-run Acceptance `
114+ * ` codecept dry-run Acceptance MyCest `
115+ * ` codecept dry-run Acceptance checkout.feature `
116+ * ` codecept dry-run tests/Acceptance/MyCest.php `
117+
118+
119+
120+
121+ ## GenerateScenarios
122+
123+ Generates user-friendly text scenarios from scenario-driven tests (Cest).
124+
125+ * ` codecept g:scenarios Acceptance ` - for all acceptance tests
126+ * ` codecept g:scenarios Acceptance --format html ` - in html format
127+ * ` codecept g:scenarios Acceptance --path doc ` - generate scenarios to ` doc ` dir
128+
129+
130+
75131## Run
76132
77133Executes tests.
@@ -165,57 +221,46 @@ Options:
165221
166222
167223
168- ## GenerateSuite
169-
170- Create new test suite. Requires suite name and actor name
171-
172- * ``
173- * ` codecept g:suite Api ` -> api + ApiTester
174- * ` codecept g:suite Integration Code ` -> integration + CodeTester
175- * ` codecept g:suite Frontend Front ` -> frontend + FrontTester
176-
177-
178-
179-
180- ## Clean
181-
182- Recursively cleans ` output ` directory and generated code.
183-
184- * ` codecept clean `
185-
186-
187-
188-
224+ ## ConfigValidate
189225
190- ## GenerateEnvironment
226+ Validates and prints Codeception config.
227+ Use it do debug Yaml configs
191228
192- Generates empty environment configuration file into envs dir :
229+ Check config :
193230
194- * ` codecept g:env firefox `
231+ * ` codecept config ` : check global config
232+ * ` codecept config Unit ` : check suite config
195233
196- Required to have ` envs ` path to be specified in ` codeception.yml `
234+ Load config:
197235
236+ * ` codecept config:validate -c path/to/another/config ` : from another dir
237+ * ` codecept config:validate -c another_config.yml ` : from another config file
198238
239+ Check overriding config values (like in ` run ` command)
199240
200- ## Init
241+ * ` codecept config:validate -o "settings: shuffle: true" ` : enable shuffle
242+ * ` codecept config:validate -o "settings: lint: false" ` : disable linting
243+ * ` codecept config:validate -o "reporters: report: \Custom\Reporter" --report ` : use custom reporter
201244
202245
203246
204- ## Console
205247
206- Try to execute test commands in run-time. You may try commands before writing the test.
248+ ## GeneratePageObject
207249
208- * ` codecept console Acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
250+ Generates PageObject. Can be generated either globally, or just for one suite.
251+ If PageObject is generated globally it will act as UIMap, without any logic in it.
209252
253+ * ` codecept g:page Login `
254+ * ` codecept g:page Registration `
255+ * ` codecept g:page Acceptance Login `
210256
211257
212- ## SelfUpdate
213258
214- Auto-updates phar archive from official site: ' https://codeception.com/codecept.phar ' .
259+ ## GenerateGroup
215260
216- * ` php codecept.phar self-update `
261+ Creates empty GroupObject - extension which handles all group events.
217262
218- @ author Franck Cassedanne < franck@cassedanne.com >
263+ * ` codecept g:group Admin `
219264
220265
221266
@@ -235,81 +280,26 @@ By default, it will create 3 suites **Acceptance**, **Functional**, and **Unit**
235280
236281
237282
238- ## GenerateStepObject
239-
240- Generates StepObject class. You will be asked for steps you want to implement.
241-
242- * ` codecept g:stepobject Acceptance AdminSteps `
243- * ` codecept g:stepobject Acceptance UserSteps --silent ` - skip action questions
244-
245-
246-
247-
248- ## DryRun
249-
250- Shows step-by-step execution process for scenario driven tests without actually running them.
251-
252- * ` codecept dry-run Acceptance `
253- * ` codecept dry-run Acceptance MyCest `
254- * ` codecept dry-run Acceptance checkout.feature `
255- * ` codecept dry-run tests/Acceptance/MyCest.php `
256-
257-
258-
259-
260- ## GenerateSnapshot
261-
262- Generates Snapshot.
263- Snapshot can be used to test dynamical data.
264- If suite name is provided, an actor class will be included into placeholder
265-
266- * ` codecept g:snapshot UserEmails `
267- * ` codecept g:snapshot Products `
268- * ` codecept g:snapshot Acceptance UserEmails `
269-
270-
271-
272- ## CompletionFallback
273-
274-
275-
276- ## GenerateScenarios
277-
278- Generates user-friendly text scenarios from scenario-driven tests (Cest).
279-
280- * ` codecept g:scenarios Acceptance ` - for all acceptance tests
281- * ` codecept g:scenarios Acceptance --format html ` - in html format
282- * ` codecept g:scenarios Acceptance --path doc ` - generate scenarios to ` doc ` dir
283-
284-
285-
286- ## GenerateGroup
287-
288- Creates empty GroupObject - extension which handles all group events.
289-
290- * ` codecept g:group Admin `
283+ ## Init
291284
292285
293286
294- ## GeneratePageObject
287+ ## SelfUpdate
295288
296- Generates PageObject. Can be generated either globally, or just for one suite.
297- If PageObject is generated globally it will act as UIMap, without any logic in it.
289+ Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar ' .
298290
299- * ` codecept g:page Login `
300- * ` codecept g:page Registration `
301- * ` codecept g:page Acceptance Login `
291+ * ` php codecept.phar self-update `
302292
293+ @author Franck Cassedanne < franck@cassedanne.com >
303294
304295
305- ## GherkinSteps
306296
307- Prints all steps from all Gherkin contexts for a specific suite
297+ ## GenerateTest
308298
309- {% highlight yaml %}
310- codecept gherkin: steps Acceptance
299+ Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
311300
312- {% endhighlight %}
301+ * ` codecept g:test Unit User `
302+ * ` codecept g:test Unit "App\User" `
313303
314304
315305
@@ -325,13 +315,23 @@ Generates Cest (scenario-driven object-oriented test) file:
325315
326316
327317
328- ## GenerateFeature
318+ ## GenerateSuite
329319
330- Generates Feature file (in Gherkin):
320+ Create new test suite. Requires suite name and actor name
331321
332- * ` codecept generate:feature suite Login `
333- * ` codecept g:feature suite subdir/subdir/login.feature `
334- * ` codecept g:feature suite login.feature -c path/to/project `
322+ * ``
323+ * ` codecept g:suite Api ` -> api + ApiTester
324+ * ` codecept g:suite Integration Code ` -> integration + CodeTester
325+ * ` codecept g:suite Frontend Front ` -> frontend + FrontTester
326+
327+
328+
329+
330+ ## Clean
331+
332+ Recursively cleans ` output ` directory and generated code.
333+
334+ * ` codecept clean `
335335
336336
337337
0 commit comments