@@ -5,34 +5,41 @@ title: Commands - Codeception - Documentation
55
66# Console Commands
77
8- ## Bootstrap
8+ ## GenerateCest
99
10- Creates default config, tests directory and sample suites for current project.
11- Use this command to start building a test suite.
10+ Generates Cest (scenario-driven object-oriented test) file:
1211
13- By default it will create 3 suites ** Acceptance** , ** Functional** , and ** Unit** .
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" `
1416
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
2017
2118
2219
20+ ## Console
2321
24- ## Init
22+ Try to execute test commands in run-time. You may try commands before writing the test.
2523
24+ * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
2625
2726
28- ## Clean
2927
30- Recursively cleans ` output ` directory and generated code.
28+ ## GenerateSnapshot
3129
32- * ` codecept clean `
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
33+
34+ * ` codecept g:snapshot UserEmails `
35+ * ` codecept g:snapshot Products `
36+ * ` codecept g:snapshot acceptance UserEmails `
3337
3438
3539
40+ ## Init
41+
42+
3643
3744## SelfUpdate
3845
@@ -44,69 +51,48 @@ Auto-updates phar archive from official site: 'https://codeception.com/codecept.
4451
4552
4653
47- ## GeneratePageObject
48-
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.
51-
52- * ` codecept g:page Login `
53- * ` codecept g:page Registration `
54- * ` codecept g:page acceptance Login `
55-
56-
57-
58- ## GherkinSteps
59-
60- Prints all steps from all Gherkin contexts for a specific suite
61-
62- {% highlight yaml %}
63- codecept gherkin: steps acceptance
64-
65- {% endhighlight %}
66-
67-
68-
69-
70- ## Build
54+ ## GenerateEnvironment
7155
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.
56+ Generates empty environment configuration file into envs dir:
7457
75- * ` codecept build `
76- * ` codecept build path/to/project `
58+ * ` codecept g:env firefox `
7759
60+ Required to have ` envs ` path to be specified in ` codeception.yml `
7861
7962
8063
81- ## GenerateCest
64+ ## Bootstrap
8265
83- Generates Cest (scenario-driven object-oriented test) file:
66+ Creates default config, tests directory and sample suites for current project.
67+ Use this command to start building a test suite.
8468
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" `
69+ By default it will create 3 suites ** Acceptance** , ** Functional** , and ** Unit** .
8970
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
9076
9177
9278
93- ## GenerateHelper
9479
95- Creates empty Helper class.
80+ ## GenerateFeature
9681
97- * ` codecept g:helper MyHelper `
98- * ` codecept g:helper "My\Helper" `
82+ Generates Feature file (in Gherkin):
9983
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 `
10087
10188
10289
103- ## GenerateEnvironment
10490
105- Generates empty environment configuration file into envs dir:
91+ ## Clean
10692
107- * ` codecept g:env firefox `
93+ Recursively cleans ` output ` directory and generated code.
10894
109- Required to have ` envs ` path to be specified in ` codeception.yml `
95+ * ` codecept clean `
11096
11197
11298
@@ -123,21 +109,25 @@ Create new test suite. Requires suite name and actor name
123109
124110
125111
126- ## Console
127112
128- Try to execute test commands in run-time. You may try commands before writing the test.
113+ ## Build
129114
130- * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
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.
131117
118+ * ` codecept build `
119+ * ` codecept build path/to/project `
132120
133121
134- ## GenerateScenarios
135122
136- Generates user-friendly text scenarios from scenario-driven tests (Cest).
137123
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
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+
141131
142132
143133
@@ -149,65 +139,63 @@ Creates empty GroupObject - extension which handles all group events.
149139
150140
151141
152- ## GherkinSnippets
142+ ## GenerateTest
153143
154- Generates code snippets for matched feature files in a suite.
155- Code snippets are expected to be implemented in Actor or PageObjects
144+ Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
156145
157- Usage:
146+ * ` codecept g:test unit User `
147+ * ` codecept g:test unit "App\User" `
158148
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
163149
164150
151+ ## GenerateScenarios
165152
166- ## DryRun
153+ Generates user-friendly text scenarios from scenario-driven tests (Cest).
167154
168- Shows step by step execution process for scenario driven tests without actually running them.
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
169158
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 `
174159
175160
161+ ## GherkinSteps
176162
163+ Prints all steps from all Gherkin contexts for a specific suite
177164
178- ## ConfigValidate
165+ {% highlight yaml %}
166+ codecept gherkin: steps acceptance
179167
180- Validates and prints Codeception config.
181- Use it do debug Yaml configs
168+ {% endhighlight %}
182169
183- Check config:
184170
185- * ` codecept config ` : check global config
186- * ` codecept config unit ` : check suite config
187171
188- Load config:
189172
190- * ` codecept config:validate -c path/to/another/config ` : from another dir
191- * ` codecept config:validate -c another_config.yml ` : from another config file
173+ ## GeneratePageObject
192174
193- Check overriding config values (like in ` run ` command)
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.
194177
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
178+ * ` codecept g:page Login `
179+ * ` codecept g:page Registration `
180+ * ` codecept g:page acceptance Login `
198181
199182
200183
184+ ## GherkinSnippets
201185
202- ## GenerateSnapshot
186+ Generates code snippets for matched feature files in a suite.
187+ Code snippets are expected to be implemented in Actor or PageObjects
203188
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
189+ Usage:
207190
208- * ` codecept g:snapshot UserEmails `
209- * ` codecept g:snapshot Products `
210- * ` codecept g:snapshot acceptance UserEmails `
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
195+
196+
197+
198+ ## CompletionFallback
211199
212200
213201
@@ -299,37 +287,49 @@ Options:
299287
300288
301289
302- ## GenerateTest
290+ ## GenerateHelper
303291
304- Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
292+ Creates empty Helper class .
305293
306- * ` codecept g:test unit User `
307- * ` codecept g:test unit "App\User " `
294+ * ` codecept g:helper MyHelper `
295+ * ` codecept g:helper "My\Helper " `
308296
309297
310298
311- ## GenerateStepObject
312299
313- Generates StepObject class. You will be asked for steps you want to implement.
300+ ## ConfigValidate
314301
315- * ` codecept g:stepobject acceptance AdminSteps `
316- * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
302+ Validates and prints Codeception config.
303+ Use it do debug Yaml configs
317304
305+ Check config:
318306
307+ * ` codecept config ` : check global config
308+ * ` codecept config unit ` : check suite config
319309
310+ Load config:
320311
321- ## GenerateFeature
312+ * ` codecept config:validate -c path/to/another/config ` : from another dir
313+ * ` codecept config:validate -c another_config.yml ` : from another config file
322314
323- Generates Feature file ( in Gherkin):
315+ Check overriding config values (like in ` run ` command)
324316
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 `
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
328320
329321
330322
331323
332- ## CompletionFallback
324+ ## DryRun
325+
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 `
332+
333333
334334
335335
0 commit comments