@@ -5,6 +5,40 @@ title: Commands - Codeception - Documentation
55
66# Console Commands
77
8+ ## SelfUpdate
9+
10+ Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar ' .
11+
12+ * ` php codecept.phar self-update `
13+
14+ @author Franck Cassedanne < franck@cassedanne.com >
15+
16+
17+
18+ ## GenerateStepObject
19+
20+ Generates StepObject class. You will be asked for steps you want to implement.
21+
22+ * ` codecept g:stepobject acceptance AdminSteps `
23+ * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
24+
25+
26+
27+
28+ ## Init
29+
30+
31+
32+ ## GenerateEnvironment
33+
34+ Generates empty environment configuration file into envs dir:
35+
36+ * ` codecept g:env firefox `
37+
38+ Required to have ` envs ` path to be specified in ` codeception.yml `
39+
40+
41+
842## Bootstrap
943
1044Creates default config, tests directory and sample suites for current project.
@@ -21,39 +55,60 @@ By default it will create 3 suites **acceptance**, **functional**, and **unit**.
2155
2256
2357
24- ## GherkinSteps
58+ ## GenerateHelper
2559
26- Prints all steps from all Gherkin contexts for a specific suite
60+ Creates empty Helper class.
2761
28- {% highlight yaml %}
29- codecept gherkin : steps acceptance
62+ * ` codecept g:helper MyHelper `
63+ * ` codecept g:helper "My\Helper" `
3064
31- {% endhighlight %}
3265
3366
3467
68+ ## DryRun
3569
36- ## ConfigValidate
70+ Shows step by step execution process for scenario driven tests without actually running them.
3771
38- Validates and prints Codeception config.
39- Use it do debug Yaml configs
72+ * ` codecept dry-run acceptance `
73+ * ` codecept dry-run acceptance MyCest `
74+ * ` codecept dry-run acceptance checkout.feature `
75+ * ` codecept dry-run tests/acceptance/MyCest.php `
4076
41- Check config:
4277
43- * ` codecept config ` : check global config
44- * ` codecept config unit ` : check suite config
4578
46- Load config:
4779
48- * ` codecept config:validate -c path/to/another/config ` : from another dir
49- * ` codecept config:validate -c another_config.yml ` : from another config file
80+ ## GenerateTest
81+
82+ Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
83+
84+ * ` codecept g:test unit User `
85+ * ` codecept g:test unit "App\User" `
86+
87+
88+
89+ ## GenerateSnapshot
90+
91+ Generates Snapshot.
92+ Snapshot can be used to test dynamical data.
93+ If suite name is provided, an actor class will be included into placeholder
94+
95+ * ` codecept g:snapshot UserEmails `
96+ * ` codecept g:snapshot Products `
97+ * ` codecept g:snapshot acceptance UserEmails `
5098
51- Check overriding config values (like in ` run ` command)
5299
53- * ` codecept config:validate -o "settings: shuffle: true" ` : enable shuffle
54- * ` codecept config:validate -o "settings: lint: false" ` : disable linting
55- * ` codecept config:validate -o "reporters: report: \Custom\Reporter" --report ` : use custom reporter
56100
101+ ## GherkinSnippets
102+
103+ Generates code snippets for matched feature files in a suite.
104+ Code snippets are expected to be implemented in Actor or PageObjects
105+
106+ Usage:
107+
108+ * ` codecept gherkin:snippets acceptance ` - snippets from all feature of acceptance tests
109+ * ` codecept gherkin:snippets acceptance/feature/users ` - snippets from ` feature/users ` dir of acceptance tests
110+ * ` codecept gherkin:snippets acceptance user_account.feature ` - snippets from a single feature file
111+ * ` codecept gherkin:snippets acceptance/feature/users/user_accout.feature ` - snippets from feature file in a dir
57112
58113
59114
@@ -66,81 +121,82 @@ Recursively cleans `output` directory and generated code.
66121
67122
68123
69- ## GenerateStepObject
124+ ## CompletionFallback
70125
71- Generates StepObject class. You will be asked for steps you want to implement.
72126
73- * ` codecept g:stepobject acceptance AdminSteps `
74- * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
75127
128+ ## GenerateGroup
76129
130+ Creates empty GroupObject - extension which handles all group events.
77131
132+ * ` codecept g:group Admin `
78133
79- ## Build
80134
81- Generates Actor classes (initially Guy classes) from suite configs.
82- Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
83135
84- * ` codecept build `
85- * ` codecept build path/to/project `
136+ ## Console
86137
138+ Try to execute test commands in run-time. You may try commands before writing the test.
87139
140+ * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
88141
89142
90- ## GeneratePageObject
91143
92- Generates PageObject. Can be generated either globally, or just for one suite.
93- If PageObject is generated globally it will act as UIMap, without any logic in it.
94144
95- * ` codecept g:page Login `
96- * ` codecept g:page Registration `
97- * ` codecept g:page acceptance Login `
145+ ## GenerateSuite
98146
147+ Create new test suite. Requires suite name and actor name
99148
149+ * ``
150+ * ` codecept g:suite api ` -> api + ApiTester
151+ * ` codecept g:suite integration Code ` -> integration + CodeTester
152+ * ` codecept g:suite frontend Front ` -> frontend + FrontTester
100153
101- ## GenerateCest
102154
103- Generates Cest (scenario-driven object-oriented test) file:
104155
105- * ` codecept generate:cest suite Login `
106- * ` codecept g:cest suite subdir/subdir/testnameCest.php `
107- * ` codecept g:cest suite LoginCest -c path/to/project `
108- * ` codecept g:cest "App\Login" `
109156
157+ ## GeneratePageObject
158+
159+ Generates PageObject. Can be generated either globally, or just for one suite.
160+ If PageObject is generated globally it will act as UIMap, without any logic in it.
161+
162+ * ` codecept g:page Login `
163+ * ` codecept g:page Registration `
164+ * ` codecept g:page acceptance Login `
110165
111166
112167
113- ## DryRun
168+ ## ConfigValidate
114169
115- Shows step by step execution process for scenario driven tests without actually running them.
170+ Validates and prints Codeception config.
171+ Use it do debug Yaml configs
116172
117- * ` codecept dry-run acceptance `
118- * ` codecept dry-run acceptance MyCest `
119- * ` codecept dry-run acceptance checkout.feature `
120- * ` codecept dry-run tests/acceptance/MyCest.php `
173+ Check config:
121174
175+ * ` codecept config ` : check global config
176+ * ` codecept config unit ` : check suite config
122177
178+ Load config:
123179
180+ * ` codecept config:validate -c path/to/another/config ` : from another dir
181+ * ` codecept config:validate -c another_config.yml ` : from another config file
124182
125- ## GenerateSuite
183+ Check overriding config values (like in ` run ` command)
126184
127- Create new test suite. Requires suite name and actor name
185+ * ` codecept config:validate -o "settings: shuffle: true" ` : enable shuffle
186+ * ` codecept config:validate -o "settings: lint: false" ` : disable linting
187+ * ` codecept config:validate -o "reporters: report: \Custom\Reporter" --report ` : use custom reporter
128188
129- * ``
130- * ` codecept g:suite api ` -> api + ApiTester
131- * ` codecept g:suite integration Code ` -> integration + CodeTester
132- * ` codecept g:suite frontend Front ` -> frontend + FrontTester
133189
134190
135191
192+ ## Build
136193
137- ## GenerateScenarios
194+ Generates Actor classes (initially Guy classes) from suite configs.
195+ Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
138196
139- Generates user-friendly text scenarios from scenario-driven tests (Cest).
197+ * ` codecept build `
198+ * ` codecept build path/to/project `
140199
141- * ` codecept g:scenarios acceptance ` - for all acceptance tests
142- * ` codecept g:scenarios acceptance --format html ` - in html format
143- * ` codecept g:scenarios acceptance --path doc ` - generate scenarios to ` doc ` dir
144200
145201
146202
@@ -232,69 +288,37 @@ Options:
232288
233289
234290
235- ## SelfUpdate
236-
237- Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar ' .
238-
239- * ` php codecept.phar self-update `
240-
241- @author Franck Cassedanne < franck@cassedanne.com >
242-
243-
244-
245-
246- ## Console
247-
248- Try to execute test commands in run-time. You may try commands before writing the test.
249-
250- * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
251-
252-
253-
254- ## GenerateTest
255-
256- Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
257-
258- * ` codecept g:test unit User `
259- * ` codecept g:test unit "App\User" `
260-
261-
262-
263- ## GenerateEnvironment
264-
265- Generates empty environment configuration file into envs dir:
266-
267- * ` codecept g:env firefox `
268-
269- Required to have ` envs ` path to be specified in ` codeception.yml `
270-
291+ ## GherkinSteps
271292
293+ Prints all steps from all Gherkin contexts for a specific suite
272294
273- ## CompletionFallback
295+ {% highlight yaml %}
296+ codecept gherkin: steps acceptance
274297
298+ {% endhighlight %}
275299
276300
277- ## Init
278301
279302
303+ ## GenerateScenarios
280304
281- ## GenerateSnapshot
305+ Generates user-friendly text scenarios from scenario-driven tests (Cest).
282306
283- Generates Snapshot.
284- Snapshot can be used to test dynamical data.
285- If suite name is provided, an actor class will be included into placeholder
307+ * ` codecept g:scenarios acceptance ` - for all acceptance tests
308+ * ` codecept g:scenarios acceptance --format html ` - in html format
309+ * ` codecept g:scenarios acceptance --path doc ` - generate scenarios to ` doc ` dir
286310
287- * ` codecept g:snapshot UserEmails `
288- * ` codecept g:snapshot Products `
289- * ` codecept g:snapshot acceptance UserEmails `
290311
291312
313+ ## GenerateCest
292314
293- ## GenerateGroup
315+ Generates Cest (scenario-driven object-oriented test) file:
294316
295- Creates empty GroupObject - extension which handles all group events.
317+ * ` codecept generate:cest suite Login `
318+ * ` codecept g:cest suite subdir/subdir/testnameCest.php `
319+ * ` codecept g:cest suite LoginCest -c path/to/project `
320+ * ` codecept g:cest "App\Login" `
296321
297- * ` codecept g:group Admin `
298322
299323
300324
@@ -309,27 +333,3 @@ Generates Feature file (in Gherkin):
309333
310334
311335
312- ## GenerateHelper
313-
314- Creates empty Helper class.
315-
316- * ` codecept g:helper MyHelper `
317- * ` codecept g:helper "My\Helper" `
318-
319-
320-
321-
322- ## GherkinSnippets
323-
324- Generates code snippets for matched feature files in a suite.
325- Code snippets are expected to be implemented in Actor or PageObjects
326-
327- Usage:
328-
329- * ` codecept gherkin:snippets acceptance ` - snippets from all feature of acceptance tests
330- * ` codecept gherkin:snippets acceptance/feature/users ` - snippets from ` feature/users ` dir of acceptance tests
331- * ` codecept gherkin:snippets acceptance user_account.feature ` - snippets from a single feature file
332- * ` codecept gherkin:snippets acceptance/feature/users/user_accout.feature ` - snippets from feature file in a dir
333-
334-
335-
0 commit comments