@@ -5,67 +5,100 @@ title: Commands - Codeception - Documentation
55
66# Console Commands
77
8- ## Bootstrap
8+ ## ConfigValidate
99
10- Creates default config, tests directory and sample suites for current project .
11- Use this command to start building a test suite.
10+ Validates and prints Codeception config .
11+ Use it do debug Yaml configs
1212
13- By default it will create 3 suites ** acceptance ** , ** functional ** , and ** unit ** .
13+ Check config:
1414
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
15+ * ` codecept config ` : check global config
16+ * ` codecept config unit ` : check suite config
2017
18+ Load config:
2119
20+ * ` codecept config:validate -c path/to/another/config ` : from another dir
21+ * ` codecept config:validate -c another_config.yml ` : from another config file
2222
23+ Check overriding config values (like in ` run ` command)
2324
24- ## GherkinSteps
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
2528
26- Prints all steps from all Gherkin contexts for a specific suite
2729
28- {% highlight yaml %}
29- codecept gherkin: steps acceptance
3030
31- {% endhighlight %}
3231
32+ ## GenerateCest
3333
34+ Generates Cest (scenario-driven object-oriented test) file:
3435
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" `
3540
36- ## ConfigValidate
3741
38- Validates and prints Codeception config.
39- Use it do debug Yaml configs
4042
41- Check config:
4243
43- * ` codecept config ` : check global config
44- * ` codecept config unit ` : check suite config
44+ ## Build
4545
46- Load config:
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.
4748
48- * ` codecept config:validate -c path/to/another/config ` : from another dir
49- * ` codecept config:validate -c another_config.yml ` : from another config file
49+ * ` codecept build `
50+ * ` codecept build path/to/project `
5051
51- Check overriding config values (like in ` run ` command)
5252
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
5653
5754
55+ ## GenerateSnapshot
5856
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
5960
60- ## Clean
61+ * ` codecept g:snapshot UserEmails `
62+ * ` codecept g:snapshot Products `
63+ * ` codecept g:snapshot acceptance UserEmails `
6164
62- Recursively cleans ` output ` directory and generated code.
6365
64- * ` codecept clean `
66+
67+ ## GenerateHelper
68+
69+ Creates empty Helper class.
70+
71+ * ` codecept g:helper MyHelper `
72+ * ` codecept g:helper "My\Helper" `
6573
6674
6775
6876
77+ ## Bootstrap
78+
79+ Creates default config, tests directory and sample suites for current project.
80+ Use this command to start building a test suite.
81+
82+ By default it will create 3 suites ** acceptance** , ** functional** , and ** unit** .
83+
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
89+
90+
91+
92+
93+ ## GenerateTest
94+
95+ Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
96+
97+ * ` codecept g:test unit User `
98+ * ` codecept g:test unit "App\User" `
99+
100+
101+
69102## GenerateStepObject
70103
71104Generates StepObject class. You will be asked for steps you want to implement.
@@ -76,37 +109,46 @@ Generates StepObject class. You will be asked for steps you want to implement.
76109
77110
78111
79- ## Build
112+ ## GenerateFeature
80113
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.
114+ Generates Feature file (in Gherkin):
83115
84- * ` codecept build `
85- * ` codecept build path/to/project `
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 `
86119
87120
88121
89122
90- ## GeneratePageObject
123+ ## GenerateSuite
91124
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.
125+ Create new test suite. Requires suite name and actor name
94126
95- * ` codecept g:page Login `
96- * ` codecept g:page Registration `
97- * ` codecept g:page acceptance Login `
127+ * ``
128+ * ` codecept g:suite api ` -> api + ApiTester
129+ * ` codecept g:suite integration Code ` -> integration + CodeTester
130+ * ` codecept g:suite frontend Front ` -> frontend + FrontTester
98131
99132
100133
101- ## GenerateCest
102134
103- Generates Cest (scenario-driven object-oriented test) file:
135+ ## SelfUpdate
104136
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" `
137+ Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar ' .
138+
139+ * ` php codecept.phar self-update `
140+
141+ @author Franck Cassedanne < franck@cassedanne.com >
142+
143+
144+
145+ ## GenerateEnvironment
146+
147+ Generates empty environment configuration file into envs dir:
148+
149+ * ` codecept g:env firefox `
109150
151+ Required to have ` envs ` path to be specified in ` codeception.yml `
110152
111153
112154
@@ -122,14 +164,7 @@ Shows step by step execution process for scenario driven tests without actually
122164
123165
124166
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
167+ ## Init
133168
134169
135170
@@ -144,6 +179,43 @@ Generates user-friendly text scenarios from scenario-driven tests (Cest).
144179
145180
146181
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
216+
217+
218+
147219## Run
148220
149221Executes tests.
@@ -232,61 +304,12 @@ Options:
232304
233305
234306
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-
271-
272-
273- ## CompletionFallback
274-
275-
276-
277- ## Init
278-
279-
307+ ## Clean
280308
281- ## GenerateSnapshot
309+ Recursively cleans ` output ` directory and generated code.
282310
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
311+ * ` codecept clean `
286312
287- * ` codecept g:snapshot UserEmails `
288- * ` codecept g:snapshot Products `
289- * ` codecept g:snapshot acceptance UserEmails `
290313
291314
292315
@@ -298,38 +321,15 @@ Creates empty GroupObject - extension which handles all group events.
298321
299322
300323
301- ## GenerateFeature
302-
303- Generates Feature file (in Gherkin):
304-
305- * ` codecept generate:feature suite Login `
306- * ` codecept g:feature suite subdir/subdir/login.feature `
307- * ` codecept g:feature suite login.feature -c path/to/project `
308-
309-
310-
311-
312- ## GenerateHelper
313-
314- Creates empty Helper class.
315-
316- * ` codecept g:helper MyHelper `
317- * ` codecept g:helper "My\Helper" `
318-
319-
320-
324+ ## GherkinSteps
321325
322- ## GherkinSnippets
326+ Prints all steps from all Gherkin contexts for a specific suite
323327
324- Generates code snippets for matched feature files in a suite.
325- Code snippets are expected to be implemented in Actor or PageObjects
328+ {% highlight yaml %}
329+ codecept gherkin : steps acceptance
326330
327- Usage:
331+ {% endhighlight %}
328332
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
333333
334334
335335
0 commit comments