@@ -5,96 +5,54 @@ title: Commands - Codeception - Documentation
55
66# Console Commands
77
8- ## GenerateStepObject
9-
10- Generates StepObject class. You will be asked for steps you want to implement.
11-
12- * ` codecept g:stepobject acceptance AdminSteps `
13- * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
14-
15-
16-
17-
18- ## GenerateFeature
19-
20- Generates Feature file (in Gherkin):
21-
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 `
25-
26-
27-
28-
29- ## Console
30-
31- Try to execute test commands in run-time. You may try commands before writing the test.
32-
33- * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
34-
35-
36-
37- ## GeneratePageObject
38-
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.
41-
42- * ` codecept g:page Login `
43- * ` codecept g:page Registration `
44- * ` codecept g:page acceptance Login `
45-
46-
47-
48-
49- ## GherkinSnippets
50-
51- Generates code snippets for matched feature files in a suite.
52- Code snippets are expected to be implemented in Actor or PageObjects
53-
54- Usage:
55-
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
60-
8+ ## ConfigValidate
619
10+ Validates and prints Codeception config.
11+ Use it do debug Yaml configs
6212
63- ## Clean
13+ Check config:
6414
65- Recursively cleans ` output ` directory and generated code.
15+ * ` codecept config ` : check global config
16+ * ` codecept config unit ` : check suite config
6617
67- * ` codecept clean `
18+ Load config:
6819
20+ * ` codecept config:validate -c path/to/another/config ` : from another dir
21+ * ` codecept config:validate -c another_config.yml ` : from another config file
6922
23+ Check overriding config values (like in ` run ` command)
7024
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
7128
72- ## GenerateGroup
7329
74- Creates empty GroupObject - extension which handles all group events.
7530
76- * ` codecept g:group Admin `
7731
32+ ## Build
7833
34+ Generates Actor classes (initially Guy classes) from suite configs.
35+ Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
7936
80- ## DryRun
37+ * ` codecept build `
38+ * ` codecept build path/to/project `
8139
82- Shows step by step execution process for scenario driven tests without actually running them.
8340
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 `
8841
8942
43+ ## Bootstrap
9044
45+ Creates default config, tests directory and sample suites for current project.
46+ Use this command to start building a test suite.
9147
92- ## GenerateTest
48+ By default it will create 3 suites ** acceptance ** , ** functional ** , and ** unit ** .
9349
94- Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
50+ * ` codecept bootstrap ` - creates ` tests ` dir and ` codeception.yml ` in current dir.
51+ * ` codecept bootstrap --empty ` - creates ` tests ` dir without suites
52+ * ` codecept bootstrap --namespace Frontend ` - creates tests, and use ` Frontend ` namespace for actor classes and helpers.
53+ * ` codecept bootstrap --actor Wizard ` - sets actor as Wizard, to have ` TestWizard ` actor in tests.
54+ * ` codecept bootstrap path/to/the/project ` - provide different path to a project, where tests should be placed
9555
96- * ` codecept g:test unit User `
97- * ` codecept g:test unit "App\User" `
9856
9957
10058
@@ -110,66 +68,47 @@ If suite name is provided, an actor class will be included into placeholder
11068
11169
11270
113- ## GenerateScenarios
114-
115- Generates user-friendly text scenarios from scenario-driven tests (Cest).
116-
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
120-
121-
122-
123- ## GenerateHelper
124-
125- Creates empty Helper class.
126-
127- * ` codecept g:helper MyHelper `
128- * ` codecept g:helper "My\Helper" `
129-
130-
71+ ## SelfUpdate
13172
73+ Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar ' .
13274
133- ## GenerateCest
75+ * ` php codecept.phar self-update `
13476
135- Generates Cest (scenario-driven object-oriented test) file:
77+ @ author Franck Cassedanne < franck@cassedanne.com >
13678
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" `
14179
14280
14381
82+ ## GenerateGroup
14483
145- ## Build
84+ Creates empty GroupObject - extension which handles all group events.
14685
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.
86+ * ` codecept g:group Admin `
14987
150- * ` codecept build `
151- * ` codecept build path/to/project `
15288
15389
90+ ## GenerateStepObject
15491
92+ Generates StepObject class. You will be asked for steps you want to implement.
15593
156- ## SelfUpdate
94+ * ` codecept g:stepobject acceptance AdminSteps `
95+ * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
15796
158- Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar ' .
15997
160- * ` php codecept.phar self-update `
16198
162- @author Franck Cassedanne < franck@cassedanne.com >
16399
100+ ## Init
164101
165102
166- ## GenerateEnvironment
167103
168- Generates empty environment configuration file into envs dir:
104+ ## GeneratePageObject
169105
170- * ` codecept g:env firefox `
106+ Generates PageObject. Can be generated either globally, or just for one suite.
107+ If PageObject is generated globally it will act as UIMap, without any logic in it.
171108
172- Required to have ` envs ` path to be specified in ` codeception.yml `
109+ * ` codecept g:page Login `
110+ * ` codecept g:page Registration `
111+ * ` codecept g:page acceptance Login `
173112
174113
175114
@@ -261,18 +200,57 @@ Options:
261200
262201
263202
203+ ## GenerateEnvironment
204+
205+ Generates empty environment configuration file into envs dir:
206+
207+ * ` codecept g:env firefox `
208+
209+ Required to have ` envs ` path to be specified in ` codeception.yml `
210+
211+
212+
213+ ## GenerateCest
214+
215+ Generates Cest (scenario-driven object-oriented test) file:
216+
217+ * ` codecept generate:cest suite Login `
218+ * ` codecept g:cest suite subdir/subdir/testnameCest.php `
219+ * ` codecept g:cest suite LoginCest -c path/to/project `
220+ * ` codecept g:cest "App\Login" `
221+
222+
223+
224+
225+ ## GenerateFeature
226+
227+ Generates Feature file (in Gherkin):
228+
229+ * ` codecept generate:feature suite Login `
230+ * ` codecept g:feature suite subdir/subdir/login.feature `
231+ * ` codecept g:feature suite login.feature -c path/to/project `
232+
233+
234+
235+
236+ ## Console
237+
238+ Try to execute test commands in run-time. You may try commands before writing the test.
239+
240+ * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
241+
242+
243+
264244## CompletionFallback
265245
266246
267247
268- ## GenerateSuite
248+ ## GenerateHelper
269249
270- Create new test suite. Requires suite name and actor name
250+ Creates empty Helper class.
271251
272- * ``
273- * ` codecept g:suite api ` -> api + ApiTester
274- * ` codecept g:suite integration Code ` -> integration + CodeTester
275- * ` codecept g:suite frontend Front ` -> frontend + FrontTester
252+ * ` codecept g:helper MyHelper `
253+ * ` codecept g:helper "My\Helper" `
276254
277255
278256
@@ -289,47 +267,69 @@ codecept gherkin:steps acceptance
289267
290268
291269
292- ## Bootstrap
270+ ## DryRun
293271
294- Creates default config, tests directory and sample suites for current project.
295- Use this command to start building a test suite.
272+ Shows step by step execution process for scenario driven tests without actually running them.
296273
297- By default it will create 3 suites ** acceptance** , ** functional** , and ** unit** .
274+ * ` codecept dry-run acceptance `
275+ * ` codecept dry-run acceptance MyCest `
276+ * ` codecept dry-run acceptance checkout.feature `
277+ * ` codecept dry-run tests/acceptance/MyCest.php `
298278
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
304279
305280
306281
282+ ## GenerateSuite
307283
308- ## Init
284+ Create new test suite. Requires suite name and actor name
309285
286+ * ``
287+ * ` codecept g:suite api ` -> api + ApiTester
288+ * ` codecept g:suite integration Code ` -> integration + CodeTester
289+ * ` codecept g:suite frontend Front ` -> frontend + FrontTester
310290
311291
312- ## ConfigValidate
313292
314- Validates and prints Codeception config.
315- Use it do debug Yaml configs
316293
317- Check config:
294+ ## GenerateScenarios
318295
319- * ` codecept config ` : check global config
320- * ` codecept config unit ` : check suite config
296+ Generates user-friendly text scenarios from scenario-driven tests (Cest).
321297
322- Load config:
298+ * ` codecept g:scenarios acceptance ` - for all acceptance tests
299+ * ` codecept g:scenarios acceptance --format html ` - in html format
300+ * ` codecept g:scenarios acceptance --path doc ` - generate scenarios to ` doc ` dir
323301
324- * ` codecept config:validate -c path/to/another/config ` : from another dir
325- * ` codecept config:validate -c another_config.yml ` : from another config file
326302
327- Check overriding config values (like in ` run ` command)
328303
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
304+ ## GenerateTest
305+
306+ Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
307+
308+ * ` codecept g:test unit User `
309+ * ` codecept g:test unit "App\User" `
310+
311+
312+
313+ ## Clean
314+
315+ Recursively cleans ` output ` directory and generated code.
332316
317+ * ` codecept clean `
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
333333
334334
335335
0 commit comments