Skip to content

Commit bf99790

Browse files
github-actions[bot]github-actions[bot]
authored andcommitted
updated
1 parent 68375b8 commit bf99790

File tree

1 file changed

+135
-135
lines changed

1 file changed

+135
-135
lines changed

docs/reference/Commands.md

Lines changed: 135 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -5,56 +5,98 @@ title: Commands - Codeception - Documentation
55

66
# Console Commands
77

8-
## ConfigValidate
8+
## GenerateStepObject
99

10-
Validates and prints Codeception config.
11-
Use it do debug Yaml configs
10+
Generates StepObject class. You will be asked for steps you want to implement.
1211

13-
Check config:
12+
* `codecept g:stepobject acceptance AdminSteps`
13+
* `codecept g:stepobject acceptance UserSteps --silent` - skip action questions
1414

15-
* `codecept config`: check global config
16-
* `codecept config unit`: check suite config
1715

18-
Load config:
1916

20-
* `codecept config:validate -c path/to/another/config`: from another dir
21-
* `codecept config:validate -c another_config.yml`: from another config file
2217

23-
Check overriding config values (like in `run` command)
18+
## GenerateFeature
2419

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
20+
Generates Feature file (in Gherkin):
2821

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`
2925

3026

3127

32-
## Build
3328

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.
29+
## Console
3630

37-
* `codecept build`
38-
* `codecept build path/to/project`
31+
Try to execute test commands in run-time. You may try commands before writing the test.
3932

33+
* `codecept console acceptance` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
4034

4135

4236

43-
## Bootstrap
37+
## GeneratePageObject
4438

45-
Creates default config, tests directory and sample suites for current project.
46-
Use this command to start building a test suite.
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.
4741

48-
By default it will create 3 suites **acceptance**, **functional**, and **unit**.
42+
* `codecept g:page Login`
43+
* `codecept g:page Registration`
44+
* `codecept g:page acceptance Login`
4945

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
5546

5647

5748

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+
61+
62+
63+
## Clean
64+
65+
Recursively cleans `output` directory and generated code.
66+
67+
* `codecept clean`
68+
69+
70+
71+
72+
## GenerateGroup
73+
74+
Creates empty GroupObject - extension which handles all group events.
75+
76+
* `codecept g:group Admin`
77+
78+
79+
80+
## DryRun
81+
82+
Shows step by step execution process for scenario driven tests without actually running them.
83+
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`
88+
89+
90+
91+
92+
## GenerateTest
93+
94+
Generates skeleton for Unit Test that extends `Codeception\TestCase\Test`.
95+
96+
* `codecept g:test unit User`
97+
* `codecept g:test unit "App\User"`
98+
99+
58100

59101
## GenerateSnapshot
60102

@@ -68,47 +110,66 @@ If suite name is provided, an actor class will be included into placeholder
68110

69111

70112

71-
## SelfUpdate
113+
## GenerateScenarios
72114

73-
Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar' .
115+
Generates user-friendly text scenarios from scenario-driven tests (Cest).
74116

75-
* `php codecept.phar self-update`
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
76120

77-
@author Franck Cassedanne <franck@cassedanne.com>
78121

79122

123+
## GenerateHelper
80124

125+
Creates empty Helper class.
81126

82-
## GenerateGroup
127+
* `codecept g:helper MyHelper`
128+
* `codecept g:helper "My\Helper"`
83129

84-
Creates empty GroupObject - extension which handles all group events.
85130

86-
* `codecept g:group Admin`
87131

88132

133+
## GenerateCest
89134

90-
## GenerateStepObject
135+
Generates Cest (scenario-driven object-oriented test) file:
91136

92-
Generates StepObject class. You will be asked for steps you want to implement.
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"`
93141

94-
* `codecept g:stepobject acceptance AdminSteps`
95-
* `codecept g:stepobject acceptance UserSteps --silent` - skip action questions
96142

97143

98144

145+
## Build
99146

100-
## Init
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.
101149

150+
* `codecept build`
151+
* `codecept build path/to/project`
102152

103153

104-
## GeneratePageObject
105154

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.
108155

109-
* `codecept g:page Login`
110-
* `codecept g:page Registration`
111-
* `codecept g:page acceptance Login`
156+
## SelfUpdate
157+
158+
Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar' .
159+
160+
* `php codecept.phar self-update`
161+
162+
@author Franck Cassedanne <franck@cassedanne.com>
163+
164+
165+
166+
## GenerateEnvironment
167+
168+
Generates empty environment configuration file into envs dir:
169+
170+
* `codecept g:env firefox`
171+
172+
Required to have `envs` path to be specified in `codeception.yml`
112173

113174

114175

@@ -200,57 +261,18 @@ Options:
200261

201262

202263

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-
244264
## CompletionFallback
245265

246266

247267

248-
## GenerateHelper
268+
## GenerateSuite
249269

250-
Creates empty Helper class.
270+
Create new test suite. Requires suite name and actor name
251271

252-
* `codecept g:helper MyHelper`
253-
* `codecept g:helper "My\Helper"`
272+
* ``
273+
* `codecept g:suite api` -> api + ApiTester
274+
* `codecept g:suite integration Code` -> integration + CodeTester
275+
* `codecept g:suite frontend Front` -> frontend + FrontTester
254276

255277

256278

@@ -267,69 +289,47 @@ codecept gherkin:steps acceptance
267289

268290

269291

270-
## DryRun
271-
272-
Shows step by step execution process for scenario driven tests without actually running them.
273-
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`
278-
279-
280-
281-
282-
## GenerateSuite
283-
284-
Create new test suite. Requires suite name and actor name
285-
286-
* ``
287-
* `codecept g:suite api` -> api + ApiTester
288-
* `codecept g:suite integration Code` -> integration + CodeTester
289-
* `codecept g:suite frontend Front` -> frontend + FrontTester
290-
291-
292-
293-
294-
## GenerateScenarios
295-
296-
Generates user-friendly text scenarios from scenario-driven tests (Cest).
292+
## Bootstrap
297293

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
294+
Creates default config, tests directory and sample suites for current project.
295+
Use this command to start building a test suite.
301296

297+
By default it will create 3 suites **acceptance**, **functional**, and **unit**.
302298

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
303304

304-
## GenerateTest
305305

306-
Generates skeleton for Unit Test that extends `Codeception\TestCase\Test`.
307306

308-
* `codecept g:test unit User`
309-
* `codecept g:test unit "App\User"`
310307

308+
## Init
311309

312310

313-
## Clean
314311

315-
Recursively cleans `output` directory and generated code.
312+
## ConfigValidate
316313

317-
* `codecept clean`
314+
Validates and prints Codeception config.
315+
Use it do debug Yaml configs
318316

317+
Check config:
319318

319+
* `codecept config`: check global config
320+
* `codecept config unit`: check suite config
320321

322+
Load config:
321323

322-
## GherkinSnippets
324+
* `codecept config:validate -c path/to/another/config`: from another dir
325+
* `codecept config:validate -c another_config.yml`: from another config file
323326

324-
Generates code snippets for matched feature files in a suite.
325-
Code snippets are expected to be implemented in Actor or PageObjects
327+
Check overriding config values (like in `run` command)
326328

327-
Usage:
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
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

Comments
 (0)