@@ -5,171 +5,214 @@ title: Commands - Codeception - Documentation
55
66# Console Commands
77
8- ## GenerateStepObject
8+ ## ConfigValidate
99
10- Generates StepObject class. You will be asked for steps you want to implement.
10+ Validates and prints Codeception config.
11+ Use it do debug Yaml configs
1112
12- * ` codecept g:stepobject acceptance AdminSteps `
13- * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
13+ Check config:
1414
15+ * ` codecept config ` : check global config
16+ * ` codecept config unit ` : check suite config
1517
18+ Load config:
1619
20+ * ` codecept config:validate -c path/to/another/config ` : from another dir
21+ * ` codecept config:validate -c another_config.yml ` : from another config file
1722
18- ## GenerateFeature
23+ Check overriding config values (like in ` run ` command)
1924
20- Generates Feature file (in Gherkin):
25+ * ` codecept config:validate -o "settings: shuffle: true" ` : enable shuffle
26+ * ` codecept config:validate -o "settings: lint: false" ` : disable linting
27+ * ` codecept config:validate -o "reporters: report: \Custom\Reporter" --report ` : use custom reporter
2128
22- * ` codecept generate:feature suite Login `
23- * ` codecept g:feature suite subdir/subdir/login.feature `
24- * ` codecept g:feature suite login.feature -c path/to/project `
2529
2630
2731
32+ ## GenerateCest
2833
29- ## Console
34+ Generates Cest (scenario-driven object-oriented test) file:
3035
31- Try to execute test commands in run-time. You may try commands before writing the test.
36+ * ` codecept generate:cest suite Login `
37+ * ` codecept g:cest suite subdir/subdir/testnameCest.php `
38+ * ` codecept g:cest suite LoginCest -c path/to/project `
39+ * ` codecept g:cest "App\Login" `
3240
33- * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
3441
3542
3643
37- ## GeneratePageObject
44+ ## Build
3845
39- Generates PageObject. Can be generated either globally, or just for one suite.
40- If PageObject is generated globally it will act as UIMap, without any logic in it .
46+ Generates Actor classes (initially Guy classes) from suite configs .
47+ Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually .
4148
42- * ` codecept g:page Login `
43- * ` codecept g:page Registration `
44- * ` codecept g:page acceptance Login `
49+ * ` codecept build `
50+ * ` codecept build path/to/project `
4551
4652
4753
4854
49- ## GherkinSnippets
55+ ## GenerateSnapshot
5056
51- Generates code snippets for matched feature files in a suite.
52- Code snippets are expected to be implemented in Actor or PageObjects
57+ Generates Snapshot.
58+ Snapshot can be used to test dynamical data.
59+ If suite name is provided, an actor class will be included into placeholder
5360
54- Usage:
61+ * ` codecept g:snapshot UserEmails `
62+ * ` codecept g:snapshot Products `
63+ * ` codecept g:snapshot acceptance UserEmails `
5564
56- * ` codecept gherkin:snippets acceptance ` - snippets from all feature of acceptance tests
57- * ` codecept gherkin:snippets acceptance/feature/users ` - snippets from ` feature/users ` dir of acceptance tests
58- * ` codecept gherkin:snippets acceptance user_account.feature ` - snippets from a single feature file
59- * ` codecept gherkin:snippets acceptance/feature/users/user_accout.feature ` - snippets from feature file in a dir
6065
6166
67+ ## GenerateHelper
6268
63- ## Clean
69+ Creates empty Helper class.
6470
65- Recursively cleans ` output ` directory and generated code.
71+ * ` codecept g:helper MyHelper `
72+ * ` codecept g:helper "My\Helper" `
6673
67- * ` codecept clean `
6874
6975
7076
77+ ## Bootstrap
7178
72- ## GenerateGroup
79+ Creates default config, tests directory and sample suites for current project.
80+ Use this command to start building a test suite.
7381
74- Creates empty GroupObject - extension which handles all group events .
82+ By default it will create 3 suites ** acceptance ** , ** functional ** , and ** unit ** .
7583
76- * ` codecept g:group Admin `
84+ * ` codecept bootstrap ` - creates ` tests ` dir and ` codeception.yml ` in current dir.
85+ * ` codecept bootstrap --empty ` - creates ` tests ` dir without suites
86+ * ` codecept bootstrap --namespace Frontend ` - creates tests, and use ` Frontend ` namespace for actor classes and helpers.
87+ * ` codecept bootstrap --actor Wizard ` - sets actor as Wizard, to have ` TestWizard ` actor in tests.
88+ * ` codecept bootstrap path/to/the/project ` - provide different path to a project, where tests should be placed
7789
7890
7991
80- ## DryRun
8192
82- Shows step by step execution process for scenario driven tests without actually running them.
93+ ## GenerateTest
8394
84- * ` codecept dry-run acceptance `
85- * ` codecept dry-run acceptance MyCest `
86- * ` codecept dry-run acceptance checkout.feature `
87- * ` codecept dry-run tests/acceptance/MyCest.php `
95+ Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
8896
97+ * ` codecept g:test unit User `
98+ * ` codecept g:test unit "App\User" `
8999
90100
91101
92- ## GenerateTest
102+ ## GenerateStepObject
93103
94- Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
104+ Generates StepObject class. You will be asked for steps you want to implement .
95105
96- * ` codecept g:test unit User `
97- * ` codecept g:test unit "App\User" `
106+ * ` codecept g:stepobject acceptance AdminSteps `
107+ * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
98108
99109
100110
101- ## GenerateSnapshot
102111
103- Generates Snapshot.
104- Snapshot can be used to test dynamical data.
105- If suite name is provided, an actor class will be included into placeholder
112+ ## GenerateFeature
106113
107- * ` codecept g:snapshot UserEmails `
108- * ` codecept g:snapshot Products `
109- * ` codecept g:snapshot acceptance UserEmails `
114+ Generates Feature file (in Gherkin):
110115
116+ * ` codecept generate:feature suite Login `
117+ * ` codecept g:feature suite subdir/subdir/login.feature `
118+ * ` codecept g:feature suite login.feature -c path/to/project `
111119
112120
113- ## GenerateScenarios
114121
115- Generates user-friendly text scenarios from scenario-driven tests (Cest).
116122
117- * ` codecept g:scenarios acceptance ` - for all acceptance tests
118- * ` codecept g:scenarios acceptance --format html ` - in html format
119- * ` codecept g:scenarios acceptance --path doc ` - generate scenarios to ` doc ` dir
123+ ## GenerateSuite
120124
125+ Create new test suite. Requires suite name and actor name
121126
127+ * ``
128+ * ` codecept g:suite api ` -> api + ApiTester
129+ * ` codecept g:suite integration Code ` -> integration + CodeTester
130+ * ` codecept g:suite frontend Front ` -> frontend + FrontTester
122131
123- ## GenerateHelper
124132
125- Creates empty Helper class.
126133
127- * ` codecept g:helper MyHelper `
128- * ` codecept g:helper "My\Helper" `
129134
135+ ## SelfUpdate
130136
137+ Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar ' .
131138
139+ * ` php codecept.phar self-update `
132140
133- ## GenerateCest
141+ @ author Franck Cassedanne < franck@cassedanne.com >
134142
135- Generates Cest (scenario-driven object-oriented test) file:
136143
137- * ` codecept generate:cest suite Login `
138- * ` codecept g:cest suite subdir/subdir/testnameCest.php `
139- * ` codecept g:cest suite LoginCest -c path/to/project `
140- * ` codecept g:cest "App\Login" `
141144
145+ ## GenerateEnvironment
142146
147+ Generates empty environment configuration file into envs dir:
143148
149+ * ` codecept g:env firefox `
144150
145- ## Build
151+ Required to have ` envs ` path to be specified in ` codeception.yml `
146152
147- Generates Actor classes (initially Guy classes) from suite configs.
148- Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
149153
150- * ` codecept build `
151- * ` codecept build path/to/project `
152154
155+ ## DryRun
153156
157+ Shows step by step execution process for scenario driven tests without actually running them.
154158
159+ * ` codecept dry-run acceptance `
160+ * ` codecept dry-run acceptance MyCest `
161+ * ` codecept dry-run acceptance checkout.feature `
162+ * ` codecept dry-run tests/acceptance/MyCest.php `
155163
156- ## SelfUpdate
157164
158- Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar ' .
159165
160- * ` php codecept.phar self-update `
161166
162- @ author Franck Cassedanne < franck@cassedanne.com >
167+ ## Init
163168
164169
165170
166- ## GenerateEnvironment
167171
168- Generates empty environment configuration file into envs dir:
172+ ## GenerateScenarios
169173
170- * ` codecept g:env firefox `
174+ Generates user-friendly text scenarios from scenario-driven tests (Cest).
171175
172- Required to have ` envs ` path to be specified in ` codeception.yml `
176+ * ` codecept g:scenarios acceptance ` - for all acceptance tests
177+ * ` codecept g:scenarios acceptance --format html ` - in html format
178+ * ` codecept g:scenarios acceptance --path doc ` - generate scenarios to ` doc ` dir
179+
180+
181+
182+ ## CompletionFallback
183+
184+
185+
186+ ## GeneratePageObject
187+
188+ Generates PageObject. Can be generated either globally, or just for one suite.
189+ If PageObject is generated globally it will act as UIMap, without any logic in it.
190+
191+ * ` codecept g:page Login `
192+ * ` codecept g:page Registration `
193+ * ` codecept g:page acceptance Login `
194+
195+
196+
197+ ## Console
198+
199+ Try to execute test commands in run-time. You may try commands before writing the test.
200+
201+ * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
202+
203+
204+
205+ ## GherkinSnippets
206+
207+ Generates code snippets for matched feature files in a suite.
208+ Code snippets are expected to be implemented in Actor or PageObjects
209+
210+ Usage:
211+
212+ * ` codecept gherkin:snippets acceptance ` - snippets from all feature of acceptance tests
213+ * ` codecept gherkin:snippets acceptance/feature/users ` - snippets from ` feature/users ` dir of acceptance tests
214+ * ` codecept gherkin:snippets acceptance user_account.feature ` - snippets from a single feature file
215+ * ` codecept gherkin:snippets acceptance/feature/users/user_accout.feature ` - snippets from feature file in a dir
173216
174217
175218
@@ -261,19 +304,20 @@ Options:
261304
262305
263306
264- ## CompletionFallback
307+ ## Clean
308+
309+ Recursively cleans ` output ` directory and generated code.
265310
311+ * ` codecept clean `
266312
267313
268- ## GenerateSuite
269314
270- Create new test suite. Requires suite name and actor name
271315
272- * ``
273- * ` codecept g:suite api ` -> api + ApiTester
274- * ` codecept g:suite integration Code ` -> integration + CodeTester
275- * ` codecept g:suite frontend Front ` -> frontend + FrontTester
316+ ## GenerateGroup
317+
318+ Creates empty GroupObject - extension which handles all group events.
276319
320+ * ` codecept g:group Admin `
277321
278322
279323
@@ -289,47 +333,3 @@ codecept gherkin:steps acceptance
289333
290334
291335
292- ## Bootstrap
293-
294- Creates default config, tests directory and sample suites for current project.
295- Use this command to start building a test suite.
296-
297- By default it will create 3 suites ** acceptance** , ** functional** , and ** unit** .
298-
299- * ` codecept bootstrap ` - creates ` tests ` dir and ` codeception.yml ` in current dir.
300- * ` codecept bootstrap --empty ` - creates ` tests ` dir without suites
301- * ` codecept bootstrap --namespace Frontend ` - creates tests, and use ` Frontend ` namespace for actor classes and helpers.
302- * ` codecept bootstrap --actor Wizard ` - sets actor as Wizard, to have ` TestWizard ` actor in tests.
303- * ` codecept bootstrap path/to/the/project ` - provide different path to a project, where tests should be placed
304-
305-
306-
307-
308- ## Init
309-
310-
311-
312- ## ConfigValidate
313-
314- Validates and prints Codeception config.
315- Use it do debug Yaml configs
316-
317- Check config:
318-
319- * ` codecept config ` : check global config
320- * ` codecept config unit ` : check suite config
321-
322- Load config:
323-
324- * ` codecept config:validate -c path/to/another/config ` : from another dir
325- * ` codecept config:validate -c another_config.yml ` : from another config file
326-
327- Check overriding config values (like in ` run ` command)
328-
329- * ` codecept config:validate -o "settings: shuffle: true" ` : enable shuffle
330- * ` codecept config:validate -o "settings: lint: false" ` : disable linting
331- * ` codecept config:validate -o "reporters: report: \Custom\Reporter" --report ` : use custom reporter
332-
333-
334-
335-
0 commit comments