@@ -5,97 +5,64 @@ title: Commands - Codeception - Documentation
55
66# Console Commands
77
8- ## ConfigValidate
9-
10- Validates and prints Codeception config.
11- Use it do debug Yaml configs
12-
13- Check config:
14-
15- * ` codecept config ` : check global config
16- * ` codecept config unit ` : check suite config
17-
18- Load config:
19-
20- * ` codecept config:validate -c path/to/another/config ` : from another dir
21- * ` codecept config:validate -c another_config.yml ` : from another config file
22-
23- Check overriding config values (like in ` run ` command)
24-
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
28-
29-
30-
31-
32- ## GenerateCest
33-
34- Generates Cest (scenario-driven object-oriented test) file:
35-
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" `
40-
41-
8+ ## Bootstrap
429
10+ Creates default config, tests directory and sample suites for current project.
11+ Use this command to start building a test suite.
4312
44- ## Build
13+ By default it will create 3 suites ** acceptance ** , ** functional ** , and ** unit ** .
4514
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.
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
4820
49- * ` codecept build `
50- * ` codecept build path/to/project `
5121
5222
5323
24+ ## GherkinSteps
5425
55- ## GenerateSnapshot
26+ Prints all steps from all Gherkin contexts for a specific suite
5627
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
28+ {% highlight yaml %}
29+ codecept gherkin: steps acceptance
6030
61- * ` codecept g:snapshot UserEmails `
62- * ` codecept g:snapshot Products `
63- * ` codecept g:snapshot acceptance UserEmails `
31+ {% endhighlight %}
6432
6533
6634
67- ## GenerateHelper
6835
69- Creates empty Helper class.
36+ ## ConfigValidate
7037
71- * ` codecept g:helper MyHelper `
72- * ` codecept g:helper "My\Helper" `
38+ Validates and prints Codeception config.
39+ Use it do debug Yaml configs
7340
41+ Check config:
7442
43+ * ` codecept config ` : check global config
44+ * ` codecept config unit ` : check suite config
7545
46+ Load config:
7647
77- ## Bootstrap
48+ * ` codecept config:validate -c path/to/another/config ` : from another dir
49+ * ` codecept config:validate -c another_config.yml ` : from another config file
7850
79- Creates default config, tests directory and sample suites for current project.
80- Use this command to start building a test suite.
51+ Check overriding config values (like in ` run ` command)
8152
82- By default it will create 3 suites ** acceptance** , ** functional** , and ** unit** .
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
8356
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
8957
9058
9159
60+ ## Clean
9261
93- ## GenerateTest
62+ Recursively cleans ` output ` directory and generated code.
9463
95- Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
64+ * ` codecept clean `
9665
97- * ` codecept g:test unit User `
98- * ` codecept g:test unit "App\User" `
9966
10067
10168
@@ -109,46 +76,37 @@ Generates StepObject class. You will be asked for steps you want to implement.
10976
11077
11178
112- ## GenerateFeature
113-
114- Generates Feature file (in Gherkin):
115-
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 `
119-
120-
121-
122-
123- ## GenerateSuite
124-
125- Create new test suite. Requires suite name and actor name
79+ ## Build
12680
127- * ``
128- * ` codecept g:suite api ` -> api + ApiTester
129- * ` codecept g:suite integration Code ` -> integration + CodeTester
130- * ` codecept g:suite frontend Front ` -> frontend + FrontTester
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.
13183
84+ * ` codecept build `
85+ * ` codecept build path/to/project `
13286
13387
13488
135- ## SelfUpdate
13689
137- Auto-updates phar archive from official site: ' https://codeception.com/codecept.phar ' .
90+ ## GeneratePageObject
13891
139- * ` php codecept.phar self-update `
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.
14094
141- @author Franck Cassedanne < franck@cassedanne.com >
95+ * ` codecept g:page Login `
96+ * ` codecept g:page Registration `
97+ * ` codecept g:page acceptance Login `
14298
14399
144100
145- ## GenerateEnvironment
101+ ## GenerateCest
146102
147- Generates empty environment configuration file into envs dir :
103+ Generates Cest (scenario-driven object-oriented test) file :
148104
149- * ` codecept g:env firefox `
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" `
150109
151- Required to have ` envs ` path to be specified in ` codeception.yml `
152110
153111
154112
@@ -164,7 +122,14 @@ Shows step by step execution process for scenario driven tests without actually
164122
165123
166124
167- ## Init
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
168133
169134
170135
@@ -179,43 +144,6 @@ Generates user-friendly text scenarios from scenario-driven tests (Cest).
179144
180145
181146
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-
219147## Run
220148
221149Executes tests.
@@ -304,12 +232,61 @@ Options:
304232
305233
306234
307- ## Clean
235+ ## SelfUpdate
308236
309- Recursively cleans ` output ` directory and generated code .
237+ Auto-updates phar archive from official site: ' https://codeception.com/codecept.phar ' .
310238
311- * ` codecept clean `
239+ * ` php codecept.phar self-update `
312240
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+
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 `
313290
314291
315292
@@ -321,15 +298,38 @@ Creates empty GroupObject - extension which handles all group events.
321298
322299
323300
324- ## GherkinSteps
301+ ## GenerateFeature
325302
326- Prints all steps from all Gherkin contexts for a specific suite
303+ Generates Feature file (in Gherkin):
327304
328- {% highlight yaml %}
329- codecept gherkin: steps acceptance
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 `
330308
331- {% endhighlight %}
332309
333310
334311
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+
335335
0 commit comments