@@ -5,40 +5,6 @@ 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-
428## Bootstrap
439
4410Creates default config, tests directory and sample suites for current project.
@@ -55,60 +21,39 @@ By default it will create 3 suites **acceptance**, **functional**, and **unit**.
5521
5622
5723
58- ## GenerateHelper
59-
60- Creates empty Helper class.
61-
62- * ` codecept g:helper MyHelper `
63- * ` codecept g:helper "My\Helper" `
64-
65-
66-
67-
68- ## DryRun
69-
70- Shows step by step execution process for scenario driven tests without actually running them.
71-
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 `
76-
77-
24+ ## GherkinSteps
7825
26+ Prints all steps from all Gherkin contexts for a specific suite
7927
80- ## GenerateTest
28+ {% highlight yaml %}
29+ codecept gherkin: steps acceptance
8130
82- Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
31+ {% endhighlight %}
8332
84- * ` codecept g:test unit User `
85- * ` codecept g:test unit "App\User" `
8633
8734
8835
89- ## GenerateSnapshot
36+ ## ConfigValidate
9037
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
38+ Validates and prints Codeception config.
39+ Use it do debug Yaml configs
9440
95- * ` codecept g:snapshot UserEmails `
96- * ` codecept g:snapshot Products `
97- * ` codecept g:snapshot acceptance UserEmails `
41+ Check config:
9842
43+ * ` codecept config ` : check global config
44+ * ` codecept config unit ` : check suite config
9945
46+ Load config:
10047
101- ## GherkinSnippets
48+ * ` codecept config:validate -c path/to/another/config ` : from another dir
49+ * ` codecept config:validate -c another_config.yml ` : from another config file
10250
103- Generates code snippets for matched feature files in a suite.
104- Code snippets are expected to be implemented in Actor or PageObjects
51+ Check overriding config values (like in ` run ` command)
10552
106- Usage:
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
10756
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
11257
11358
11459
@@ -121,35 +66,23 @@ Recursively cleans `output` directory and generated code.
12166
12267
12368
124- ## CompletionFallback
125-
126-
127-
128- ## GenerateGroup
129-
130- Creates empty GroupObject - extension which handles all group events.
131-
132- * ` codecept g:group Admin `
133-
134-
135-
136- ## Console
69+ ## GenerateStepObject
13770
138- Try to execute test commands in run-time . You may try commands before writing the test .
71+ Generates StepObject class . You will be asked for steps you want to implement .
13972
140- * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
73+ * ` codecept g:stepobject acceptance AdminSteps `
74+ * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
14175
14276
14377
14478
145- ## GenerateSuite
79+ ## Build
14680
147- Create new test suite. Requires suite name and actor name
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.
14883
149- * ``
150- * ` codecept g:suite api ` -> api + ApiTester
151- * ` codecept g:suite integration Code ` -> integration + CodeTester
152- * ` codecept g:suite frontend Front ` -> frontend + FrontTester
84+ * ` codecept build `
85+ * ` codecept build path/to/project `
15386
15487
15588
@@ -165,39 +98,50 @@ If PageObject is generated globally it will act as UIMap, without any logic in i
16598
16699
167100
168- ## ConfigValidate
101+ ## GenerateCest
169102
170- Validates and prints Codeception config.
171- Use it do debug Yaml configs
103+ Generates Cest (scenario-driven object-oriented test) file:
172104
173- Check config:
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" `
174109
175- * ` codecept config ` : check global config
176- * ` codecept config unit ` : check suite config
177110
178- Load config:
179111
180- * ` codecept config:validate -c path/to/another/config ` : from another dir
181- * ` codecept config:validate -c another_config.yml ` : from another config file
182112
183- Check overriding config values (like in ` run ` command)
113+ ## DryRun
184114
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
115+ Shows step by step execution process for scenario driven tests without actually running them.
116+
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 `
188121
189122
190123
191124
192- ## Build
125+ ## GenerateSuite
126+
127+ Create new test suite. Requires suite name and actor name
128+
129+ * ``
130+ * ` codecept g:suite api ` -> api + ApiTester
131+ * ` codecept g:suite integration Code ` -> integration + CodeTester
132+ * ` codecept g:suite frontend Front ` -> frontend + FrontTester
193133
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.
196134
197- * ` codecept build `
198- * ` codecept build path/to/project `
199135
200136
137+ ## GenerateScenarios
138+
139+ Generates user-friendly text scenarios from scenario-driven tests (Cest).
140+
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
144+
201145
202146
203147## Run
@@ -288,37 +232,69 @@ Options:
288232
289233
290234
291- ## GherkinSteps
235+ ## SelfUpdate
292236
293- Prints all steps from all Gherkin contexts for a specific suite
237+ Auto-updates phar archive from official site: ' https://codeception.com/codecept.phar ' .
294238
295- {% highlight yaml %}
296- codecept gherkin: steps acceptance
239+ * ` php codecept.phar self-update `
297240
298- {% endhighlight %}
241+ @ author Franck Cassedanne < franck@cassedanne.com >
299242
300243
301244
302245
303- ## GenerateScenarios
246+ ## Console
304247
305- Generates user-friendly text scenarios from scenario-driven tests (Cest) .
248+ Try to execute test commands in run-time. You may try commands before writing the test .
306249
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
250+ * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
310251
311252
312253
313- ## GenerateCest
254+ ## GenerateTest
314255
315- Generates Cest (scenario-driven object-oriented test) file:
256+ Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
316257
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" `
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+
271+
272+
273+ ## CompletionFallback
274+
275+
276+
277+ ## Init
278+
279+
280+
281+ ## GenerateSnapshot
282+
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
286+
287+ * ` codecept g:snapshot UserEmails `
288+ * ` codecept g:snapshot Products `
289+ * ` codecept g:snapshot acceptance UserEmails `
290+
291+
292+
293+ ## GenerateGroup
294+
295+ Creates empty GroupObject - extension which handles all group events.
321296
297+ * ` codecept g:group Admin `
322298
323299
324300
@@ -333,3 +309,27 @@ Generates Feature file (in Gherkin):
333309
334310
335311
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