@@ -5,39 +5,32 @@ title: Commands - Codeception - Documentation
55
66# Console Commands
77
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-
8+ ## Bootstrap
179
10+ Creates default config, tests directory and sample suites for current project.
11+ Use this command to start building a test suite.
1812
13+ By default it will create 3 suites ** Acceptance** , ** Functional** , and ** Unit** .
1914
20- ## Console
15+ * ` codecept bootstrap ` - creates ` tests ` dir and ` codeception.yml ` in current dir.
16+ * ` codecept bootstrap --empty ` - creates ` tests ` dir without suites
17+ * ` codecept bootstrap --namespace Frontend ` - creates tests, and use ` Frontend ` namespace for actor classes and helpers.
18+ * ` codecept bootstrap --actor Wizard ` - sets actor as Wizard, to have ` TestWizard ` actor in tests.
19+ * ` codecept bootstrap path/to/the/project ` - provide different path to a project, where tests should be placed
2120
22- Try to execute test commands in run-time. You may try commands before writing the test.
2321
24- * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
2522
2623
24+ ## Init
2725
28- ## GenerateSnapshot
2926
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
3327
34- * ` codecept g:snapshot UserEmails `
35- * ` codecept g:snapshot Products `
36- * ` codecept g:snapshot acceptance UserEmails `
28+ ## Clean
3729
30+ Recursively cleans ` output ` directory and generated code.
3831
32+ * ` codecept clean `
3933
40- ## Init
4134
4235
4336
@@ -51,48 +44,69 @@ Auto-updates phar archive from official site: 'https://codeception.com/codecept.
5144
5245
5346
54- ## GenerateEnvironment
47+ ## GeneratePageObject
5548
56- Generates empty environment configuration file into envs dir:
49+ Generates PageObject. Can be generated either globally, or just for one suite.
50+ If PageObject is generated globally it will act as UIMap, without any logic in it.
5751
58- * ` codecept g:env firefox `
52+ * ` codecept g:page Login `
53+ * ` codecept g:page Registration `
54+ * ` codecept g:page acceptance Login `
5955
60- Required to have ` envs ` path to be specified in ` codeception.yml `
6156
6257
58+ ## GherkinSteps
6359
64- ## Bootstrap
60+ Prints all steps from all Gherkin contexts for a specific suite
6561
66- Creates default config, tests directory and sample suites for current project.
67- Use this command to start building a test suite.
62+ {% highlight yaml %}
63+ codecept gherkin : steps acceptance
6864
69- By default it will create 3 suites ** Acceptance ** , ** Functional ** , and ** Unit ** .
65+ {% endhighlight %}
7066
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
7667
7768
7869
70+ ## Build
7971
80- ## GenerateFeature
72+ Generates Actor classes (initially Guy classes) from suite configs.
73+ Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
8174
82- Generates Feature file (in Gherkin):
75+ * ` codecept build `
76+ * ` codecept build path/to/project `
8377
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 `
8778
8879
8980
81+ ## GenerateCest
9082
91- ## Clean
83+ Generates Cest (scenario-driven object-oriented test) file:
84+
85+ * ` codecept generate:cest suite Login `
86+ * ` codecept g:cest suite subdir/subdir/testnameCest.php `
87+ * ` codecept g:cest suite LoginCest -c path/to/project `
88+ * ` codecept g:cest "App\Login" `
9289
93- Recursively cleans ` output ` directory and generated code.
9490
95- * ` codecept clean `
91+
92+
93+ ## GenerateHelper
94+
95+ Creates empty Helper class.
96+
97+ * ` codecept g:helper MyHelper `
98+ * ` codecept g:helper "My\Helper" `
99+
100+
101+
102+
103+ ## GenerateEnvironment
104+
105+ Generates empty environment configuration file into envs dir:
106+
107+ * ` codecept g:env firefox `
108+
109+ Required to have ` envs ` path to be specified in ` codeception.yml `
96110
97111
98112
@@ -109,25 +123,21 @@ Create new test suite. Requires suite name and actor name
109123
110124
111125
126+ ## Console
112127
113- ## Build
114-
115- Generates Actor classes (initially Guy classes) from suite configs.
116- Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
117-
118- * ` codecept build `
119- * ` codecept build path/to/project `
120-
128+ Try to execute test commands in run-time. You may try commands before writing the test.
121129
130+ * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
122131
123132
124- ## GenerateStepObject
125133
126- Generates StepObject class. You will be asked for steps you want to implement.
134+ ## GenerateScenarios
127135
128- * ` codecept g:stepobject acceptance AdminSteps `
129- * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
136+ Generates user-friendly text scenarios from scenario-driven tests (Cest).
130137
138+ * ` codecept g:scenarios acceptance ` - for all acceptance tests
139+ * ` codecept g:scenarios acceptance --format html ` - in html format
140+ * ` codecept g:scenarios acceptance --path doc ` - generate scenarios to ` doc ` dir
131141
132142
133143
@@ -139,63 +149,65 @@ Creates empty GroupObject - extension which handles all group events.
139149
140150
141151
142- ## GenerateTest
143-
144- Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
152+ ## GherkinSnippets
145153
146- * ` codecept g:test unit User `
147- * ` codecept g:test unit "App\User" `
154+ Generates code snippets for matched feature files in a suite.
155+ Code snippets are expected to be implemented in Actor or PageObjects
148156
157+ Usage:
149158
159+ * ` codecept gherkin:snippets acceptance ` - snippets from all feature of acceptance tests
160+ * ` codecept gherkin:snippets acceptance/feature/users ` - snippets from ` feature/users ` dir of acceptance tests
161+ * ` codecept gherkin:snippets acceptance user_account.feature ` - snippets from a single feature file
162+ * ` codecept gherkin:snippets acceptance/feature/users/user_accout.feature ` - snippets from feature file in a dir
150163
151- ## GenerateScenarios
152164
153- Generates user-friendly text scenarios from scenario-driven tests (Cest).
154165
155- * ` codecept g:scenarios acceptance ` - for all acceptance tests
156- * ` codecept g:scenarios acceptance --format html ` - in html format
157- * ` codecept g:scenarios acceptance --path doc ` - generate scenarios to ` doc ` dir
166+ ## DryRun
158167
168+ Shows step by step execution process for scenario driven tests without actually running them.
159169
170+ * ` codecept dry-run acceptance `
171+ * ` codecept dry-run acceptance MyCest `
172+ * ` codecept dry-run acceptance checkout.feature `
173+ * ` codecept dry-run tests/acceptance/MyCest.php `
160174
161- ## GherkinSteps
162175
163- Prints all steps from all Gherkin contexts for a specific suite
164176
165- {% highlight yaml %}
166- codecept gherkin: steps acceptance
167177
168- {% endhighlight %}
178+ ## ConfigValidate
169179
180+ Validates and prints Codeception config.
181+ Use it do debug Yaml configs
170182
183+ Check config:
171184
185+ * ` codecept config ` : check global config
186+ * ` codecept config unit ` : check suite config
172187
173- ## GeneratePageObject
188+ Load config:
174189
175- Generates PageObject. Can be generated either globally, or just for one suite.
176- If PageObject is generated globally it will act as UIMap, without any logic in it.
190+ * ` codecept config:validate -c path/to/another/config ` : from another dir
191+ * ` codecept config:validate -c another_config.yml ` : from another config file
177192
178- * ` codecept g:page Login `
179- * ` codecept g:page Registration `
180- * ` codecept g:page acceptance Login `
193+ Check overriding config values (like in ` run ` command)
181194
195+ * ` codecept config:validate -o "settings: shuffle: true" ` : enable shuffle
196+ * ` codecept config:validate -o "settings: lint: false" ` : disable linting
197+ * ` codecept config:validate -o "reporters: report: \Custom\Reporter" --report ` : use custom reporter
182198
183199
184- ## GherkinSnippets
185200
186- Generates code snippets for matched feature files in a suite.
187- Code snippets are expected to be implemented in Actor or PageObjects
188-
189- Usage:
190-
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
195201
202+ ## GenerateSnapshot
196203
204+ Generates Snapshot.
205+ Snapshot can be used to test dynamical data.
206+ If suite name is provided, an actor class will be included into placeholder
197207
198- ## CompletionFallback
208+ * ` codecept g:snapshot UserEmails `
209+ * ` codecept g:snapshot Products `
210+ * ` codecept g:snapshot acceptance UserEmails `
199211
200212
201213
@@ -287,49 +299,37 @@ Options:
287299
288300
289301
290- ## GenerateHelper
291-
292- Creates empty Helper class.
293-
294- * ` codecept g:helper MyHelper `
295- * ` codecept g:helper "My\Helper" `
302+ ## GenerateTest
296303
304+ Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
297305
306+ * ` codecept g:test unit User `
307+ * ` codecept g:test unit "App\User" `
298308
299309
300- ## ConfigValidate
301310
302- Validates and prints Codeception config.
303- Use it do debug Yaml configs
311+ ## GenerateStepObject
304312
305- Check config:
313+ Generates StepObject class. You will be asked for steps you want to implement.
306314
307- * ` codecept config ` : check global config
308- * ` codecept config unit ` : check suite config
315+ * ` codecept g:stepobject acceptance AdminSteps `
316+ * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
309317
310- Load config:
311318
312- * ` codecept config:validate -c path/to/another/config ` : from another dir
313- * ` codecept config:validate -c another_config.yml ` : from another config file
314319
315- Check overriding config values (like in ` run ` command)
316320
317- * ` codecept config:validate -o "settings: shuffle: true" ` : enable shuffle
318- * ` codecept config:validate -o "settings: lint: false" ` : disable linting
319- * ` codecept config:validate -o "reporters: report: \Custom\Reporter" --report ` : use custom reporter
321+ ## GenerateFeature
320322
323+ Generates Feature file (in Gherkin):
321324
325+ * ` codecept generate:feature suite Login `
326+ * ` codecept g:feature suite subdir/subdir/login.feature `
327+ * ` codecept g:feature suite login.feature -c path/to/project `
322328
323329
324- ## DryRun
325330
326- Shows step by step execution process for scenario driven tests without actually running them.
327-
328- * ` codecept dry-run acceptance `
329- * ` codecept dry-run acceptance MyCest `
330- * ` codecept dry-run acceptance checkout.feature `
331- * ` codecept dry-run tests/acceptance/MyCest.php `
332331
332+ ## CompletionFallback
333333
334334
335335
0 commit comments