@@ -5,16 +5,37 @@ title: Commands - Codeception - Documentation
55
66# Console Commands
77
8- ## DryRun
8+ ## Build
9+
10+ Generates Actor classes (initially Guy classes) from suite configs.
11+ Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
12+
13+ * ` codecept build `
14+ * ` codecept build path/to/project `
15+
916
10- Shows step-by-step execution process for scenario driven tests without actually running them.
1117
12- * ` codecept dry-run Acceptance `
13- * ` codecept dry-run Acceptance MyCest `
14- * ` codecept dry-run Acceptance checkout.feature `
15- * ` codecept dry-run tests/Acceptance/MyCest.php `
18+
19+ ## Console
20+
21+ Try to execute test commands in run-time. You may try commands before writing the test.
22+
23+ * ` codecept console Acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
24+
1625
1726
27+ ## GherkinSnippets
28+
29+ Generates code snippets for matched feature files in a suite.
30+ Code snippets are expected to be implemented in Actor or PageObjects
31+
32+ Usage:
33+
34+ * ` codecept gherkin:snippets Acceptance ` - snippets from all feature of acceptance tests
35+ * ` codecept gherkin:snippets Acceptance/feature/users ` - snippets from ` feature/users ` dir of acceptance tests
36+ * ` codecept gherkin:snippets Acceptance user_account.feature ` - snippets from a single feature file
37+ * ` codecept gherkin:snippets Acceptance/feature/users/user_accout.feature ` - snippets from feature file in a dir
38+
1839
1940
2041## GenerateSnapshot
@@ -29,92 +50,81 @@ If suite name is provided, an actor class will be included into placeholder
2950
3051
3152
32- ## Clean
33-
34- Recursively cleans ` output ` directory and generated code.
35-
36- * ` codecept clean `
37-
53+ ## GenerateFeature
3854
55+ Generates Feature file (in Gherkin):
3956
57+ * ` codecept generate:feature suite Login `
58+ * ` codecept g:feature suite subdir/subdir/login.feature `
59+ * ` codecept g:feature suite login.feature -c path/to/project `
4060
41- ## GenerateTest
4261
43- Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
4462
45- * ` codecept g:test Unit User `
46- * ` codecept g:test Unit "App\User" `
4763
64+ ## GherkinSteps
4865
66+ Prints all steps from all Gherkin contexts for a specific suite
4967
50- ## GenerateHelper
68+ {% highlight yaml %}
69+ codecept gherkin: steps Acceptance
5170
52- Creates empty Helper class.
71+ {% endhighlight %}
5372
54- * ` codecept g:helper MyHelper `
55- * ` codecept g:helper "My\Helper" `
5673
5774
75+ ## CompletionFallback
5876
59- ## GenerateCest
6077
61- Generates Cest (scenario-driven object-oriented test) file:
6278
63- * ` codecept generate:cest suite Login `
64- * ` codecept g:cest suite subdir/subdir/testnameCest.php `
65- * ` codecept g:cest suite LoginCest -c path/to/project `
66- * ` codecept g:cest "App\Login" `
79+ ## GenerateStepObject
6780
81+ Generates StepObject class. You will be asked for steps you want to implement.
6882
83+ * ` codecept g:stepobject Acceptance AdminSteps `
84+ * ` codecept g:stepobject Acceptance UserSteps --silent ` - skip action questions
6985
7086
71- ## CompletionFallback
7287
7388
89+ ## GenerateHelper
7490
75- ## ConfigValidate
91+ Creates empty Helper class.
7692
77- Validates and prints Codeception config.
78- Use it do debug Yaml configs
93+ * ` codecept g:helper MyHelper `
94+ * ` codecept g:helper "My\Helper" `
7995
80- Check config:
8196
82- * ` codecept config ` : check global config
83- * ` codecept config Unit ` : check suite config
8497
85- Load config:
8698
87- * ` codecept config:validate -c path/to/another/config ` : from another dir
88- * ` codecept config:validate -c another_config.yml ` : from another config file
99+ ## GenerateEnvironment
89100
90- Check overriding config values (like in ` run ` command)
101+ Generates empty environment configuration file into envs dir:
91102
92- * ` codecept config:validate -o "settings: shuffle: true" ` : enable shuffle
93- * ` codecept config:validate -o "settings: lint: false" ` : disable linting
94- * ` codecept config:validate -o "reporters: report: \Custom\Reporter" --report ` : use custom reporter
103+ * ` codecept g:env firefox `
95104
105+ Required to have ` envs ` path to be specified in ` codeception.yml `
96106
97107
98108
99- ## GherkinSteps
109+ ## DryRun
100110
101- Prints all steps from all Gherkin contexts for a specific suite
111+ Shows step-by-step execution process for scenario driven tests without actually running them.
102112
103- {% highlight yaml %}
104- codecept gherkin: steps Acceptance
113+ * ` codecept dry-run Acceptance `
114+ * ` codecept dry-run Acceptance MyCest `
115+ * ` codecept dry-run Acceptance checkout.feature `
116+ * ` codecept dry-run tests/Acceptance/MyCest.php `
105117
106- {% endhighlight %}
107118
108119
109120
110- ## GeneratePageObject
121+ ## GenerateScenarios
111122
112- Generates PageObject. Can be generated either globally, or just for one suite.
113- If PageObject is generated globally it will act as UIMap, without any logic in it.
123+ Generates user-friendly text scenarios from scenario-driven tests (Cest).
114124
115- * ` codecept g:page Login `
116- * ` codecept g:page Registration `
117- * ` codecept g:page Acceptance Login `
125+ * ` codecept g:scenarios Acceptance ` - for all acceptance tests
126+ * ` codecept g:scenarios Acceptance --format html ` - in html format
127+ * ` codecept g:scenarios Acceptance --path doc ` - generate scenarios to ` doc ` dir
118128
119129
120130
@@ -211,51 +221,38 @@ Options:
211221
212222
213223
214- ## Bootstrap
215-
216- Creates default config, tests directory and sample suites for current project.
217- Use this command to start building a test suite.
218-
219- By default, it will create 3 suites ** Acceptance** , ** Functional** , and ** Unit** .
220-
221- * ` codecept bootstrap ` - creates ` tests ` dir and ` codeception.yml ` in current dir.
222- * ` codecept bootstrap --empty ` - creates ` tests ` dir without suites
223- * ` codecept bootstrap --namespace Frontend ` - creates tests, and use ` Frontend ` namespace for actor classes and helpers.
224- * ` codecept bootstrap --actor Wizard ` - sets actor as Wizard, to have ` TestWizard ` actor in tests.
225- * ` codecept bootstrap path/to/the/project ` - provide different path to a project, where tests should be placed
226-
227-
228-
229-
230- ## GenerateScenarios
231-
232- Generates user-friendly text scenarios from scenario-driven tests (Cest).
224+ ## ConfigValidate
233225
234- * ` codecept g:scenarios Acceptance ` - for all acceptance tests
235- * ` codecept g:scenarios Acceptance --format html ` - in html format
236- * ` codecept g:scenarios Acceptance --path doc ` - generate scenarios to ` doc ` dir
226+ Validates and prints Codeception config.
227+ Use it do debug Yaml configs
237228
229+ Check config:
238230
231+ * ` codecept config ` : check global config
232+ * ` codecept config Unit ` : check suite config
239233
240- ## GenerateFeature
234+ Load config:
241235
242- Generates Feature file (in Gherkin):
236+ * ` codecept config:validate -c path/to/another/config ` : from another dir
237+ * ` codecept config:validate -c another_config.yml ` : from another config file
243238
244- * ` codecept generate:feature suite Login `
245- * ` codecept g:feature suite subdir/subdir/login.feature `
246- * ` codecept g:feature suite login.feature -c path/to/project `
239+ Check overriding config values (like in ` run ` command)
247240
241+ * ` codecept config:validate -o "settings: shuffle: true" ` : enable shuffle
242+ * ` codecept config:validate -o "settings: lint: false" ` : disable linting
243+ * ` codecept config:validate -o "reporters: report: \Custom\Reporter" --report ` : use custom reporter
248244
249245
250246
251- ## Build
252247
253- Generates Actor classes (initially Guy classes) from suite configs.
254- Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
248+ ## GeneratePageObject
255249
256- * ` codecept build `
257- * ` codecept build path/to/project `
250+ Generates PageObject. Can be generated either globally, or just for one suite.
251+ If PageObject is generated globally it will act as UIMap, without any logic in it.
258252
253+ * ` codecept g:page Login `
254+ * ` codecept g:page Registration `
255+ * ` codecept g:page Acceptance Login `
259256
260257
261258
@@ -267,17 +264,23 @@ Creates empty GroupObject - extension which handles all group events.
267264
268265
269266
270- ## Init
267+ ## Bootstrap
271268
269+ Creates default config, tests directory and sample suites for current project.
270+ Use this command to start building a test suite.
272271
272+ By default, it will create 3 suites ** Acceptance** , ** Functional** , and ** Unit** .
273273
274- ## GenerateEnvironment
274+ * ` codecept bootstrap ` - creates ` tests ` dir and ` codeception.yml ` in current dir.
275+ * ` codecept bootstrap --empty ` - creates ` tests ` dir without suites
276+ * ` codecept bootstrap --namespace Frontend ` - creates tests, and use ` Frontend ` namespace for actor classes and helpers.
277+ * ` codecept bootstrap --actor Wizard ` - sets actor as Wizard, to have ` TestWizard ` actor in tests.
278+ * ` codecept bootstrap path/to/the/project ` - provide different path to a project, where tests should be placed
275279
276- Generates empty environment configuration file into envs dir:
277280
278- * ` codecept g:env firefox `
279281
280- Required to have ` envs ` path to be specified in ` codeception.yml `
282+
283+ ## Init
281284
282285
283286
@@ -291,36 +294,24 @@ Auto-updates phar archive from official site: 'https://codeception.com/codecept.
291294
292295
293296
294- ## GherkinSnippets
295-
296- Generates code snippets for matched feature files in a suite.
297- Code snippets are expected to be implemented in Actor or PageObjects
298-
299- Usage:
300-
301- * ` codecept gherkin:snippets Acceptance ` - snippets from all feature of acceptance tests
302- * ` codecept gherkin:snippets Acceptance/feature/users ` - snippets from ` feature/users ` dir of acceptance tests
303- * ` codecept gherkin:snippets Acceptance user_account.feature ` - snippets from a single feature file
304- * ` codecept gherkin:snippets Acceptance/feature/users/user_accout.feature ` - snippets from feature file in a dir
305-
306-
307-
308- ## GenerateStepObject
309-
310- Generates StepObject class. You will be asked for steps you want to implement.
297+ ## GenerateTest
311298
312- * ` codecept g:stepobject Acceptance AdminSteps `
313- * ` codecept g:stepobject Acceptance UserSteps --silent ` - skip action questions
299+ Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
314300
301+ * ` codecept g:test Unit User `
302+ * ` codecept g:test Unit "App\User" `
315303
316304
317305
306+ ## GenerateCest
318307
319- ## Console
308+ Generates Cest (scenario-driven object-oriented test) file:
320309
321- Try to execute test commands in run-time. You may try commands before writing the test.
310+ * ` codecept generate:cest suite Login `
311+ * ` codecept g:cest suite subdir/subdir/testnameCest.php `
312+ * ` codecept g:cest suite LoginCest -c path/to/project `
313+ * ` codecept g:cest "App\Login" `
322314
323- * ` codecept console Acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
324315
325316
326317
@@ -336,3 +327,12 @@ Create new test suite. Requires suite name and actor name
336327
337328
338329
330+ ## Clean
331+
332+ Recursively cleans ` output ` directory and generated code.
333+
334+ * ` codecept clean `
335+
336+
337+
338+
0 commit comments