Skip to content

Commit 33218eb

Browse files
github-actions[bot]github-actions[bot]
github-actions[bot]
authored and
github-actions[bot]
committed
updated
1 parent 8963202 commit 33218eb

File tree

1 file changed

+118
-118
lines changed

1 file changed

+118
-118
lines changed

docs/reference/Commands.md

+118-118
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,69 @@ 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+
## GenerateScenarios
19+
20+
Generates user-friendly text scenarios from scenario-driven tests (Cest).
21+
22+
* `codecept g:scenarios acceptance` - for all acceptance tests
23+
* `codecept g:scenarios acceptance --format html` - in html format
24+
* `codecept g:scenarios acceptance --path doc` - generate scenarios to `doc` dir
25+
26+
27+
28+
## GenerateSnapshot
29+
30+
Generates Snapshot.
31+
Snapshot can be used to test dynamical data.
32+
If suite name is provided, an actor class will be included into placeholder
33+
34+
* `codecept g:snapshot UserEmails`
35+
* `codecept g:snapshot Products`
36+
* `codecept g:snapshot acceptance UserEmails`
37+
38+
39+
40+
## DryRun
41+
42+
Shows step-by-step execution process for scenario driven tests without actually running them.
43+
44+
* `codecept dry-run acceptance`
45+
* `codecept dry-run acceptance MyCest`
46+
* `codecept dry-run acceptance checkout.feature`
47+
* `codecept dry-run tests/acceptance/MyCest.php`
48+
49+
50+
51+
52+
## GenerateTest
53+
54+
Generates skeleton for Unit Test that extends `Codeception\TestCase\Test`.
55+
56+
* `codecept g:test unit User`
57+
* `codecept g:test unit "App\User"`
58+
59+
60+
61+
## GenerateHelper
62+
63+
Creates empty Helper class.
64+
65+
* `codecept g:helper MyHelper`
66+
* `codecept g:helper "My\Helper"`
67+
68+
69+
70+
871
## GherkinSnippets
972

1073
Generates code snippets for matched feature files in a suite.
@@ -19,14 +82,25 @@ Usage:
1982

2083

2184

22-
## GenerateHelper
85+
## GeneratePageObject
2386

24-
Creates empty Helper class.
87+
Generates PageObject. Can be generated either globally, or just for one suite.
88+
If PageObject is generated globally it will act as UIMap, without any logic in it.
89+
90+
* `codecept g:page Login`
91+
* `codecept g:page Registration`
92+
* `codecept g:page acceptance Login`
2593

26-
* `codecept g:helper MyHelper`
27-
* `codecept g:helper "My\Helper"`
2894

2995

96+
## GenerateEnvironment
97+
98+
Generates empty environment configuration file into envs dir:
99+
100+
* `codecept g:env firefox`
101+
102+
Required to have `envs` path to be specified in `codeception.yml`
103+
30104

31105

32106
## Run
@@ -118,64 +192,32 @@ Options:
118192

119193

120194

121-
## GenerateSnapshot
122-
123-
Generates Snapshot.
124-
Snapshot can be used to test dynamical data.
125-
If suite name is provided, an actor class will be included into placeholder
126-
127-
* `codecept g:snapshot UserEmails`
128-
* `codecept g:snapshot Products`
129-
* `codecept g:snapshot acceptance UserEmails`
130-
131-
132-
133-
## GeneratePageObject
134-
135-
Generates PageObject. Can be generated either globally, or just for one suite.
136-
If PageObject is generated globally it will act as UIMap, without any logic in it.
137-
138-
* `codecept g:page Login`
139-
* `codecept g:page Registration`
140-
* `codecept g:page acceptance Login`
141-
142-
143-
144195
## CompletionFallback
145196

146197

147198

148-
## GenerateScenarios
149-
150-
Generates user-friendly text scenarios from scenario-driven tests (Cest).
199+
## GherkinSteps
151200

152-
* `codecept g:scenarios acceptance` - for all acceptance tests
153-
* `codecept g:scenarios acceptance --format html` - in html format
154-
* `codecept g:scenarios acceptance --path doc` - generate scenarios to `doc` dir
201+
Prints all steps from all Gherkin contexts for a specific suite
155202

203+
{% highlight yaml %}
204+
codecept gherkin:steps acceptance
156205

206+
{% endhighlight %}
157207

158-
## Bootstrap
159208

160-
Creates default config, tests directory and sample suites for current project.
161-
Use this command to start building a test suite.
162209

163-
By default, it will create 3 suites **Acceptance**, **Functional**, and **Unit**.
164210

165-
* `codecept bootstrap` - creates `tests` dir and `codeception.yml` in current dir.
166-
* `codecept bootstrap --empty` - creates `tests` dir without suites
167-
* `codecept bootstrap --namespace Frontend` - creates tests, and use `Frontend` namespace for actor classes and helpers.
168-
* `codecept bootstrap --actor Wizard` - sets actor as Wizard, to have `TestWizard` actor in tests.
169-
* `codecept bootstrap path/to/the/project` - provide different path to a project, where tests should be placed
211+
## Clean
170212

213+
Recursively cleans `output` directory and generated code.
171214

215+
* `codecept clean`
172216

173217

174-
## GenerateGroup
175218

176-
Creates empty GroupObject - extension which handles all group events.
177219

178-
* `codecept g:group Admin`
220+
## Init
179221

180222

181223

@@ -191,35 +233,31 @@ Generates Cest (scenario-driven object-oriented test) file:
191233

192234

193235

194-
## GherkinSteps
195-
196-
Prints all steps from all Gherkin contexts for a specific suite
197-
198-
{% highlight yaml %}
199-
codecept gherkin:steps acceptance
200-
201-
{% endhighlight %}
236+
## Console
202237

238+
Try to execute test commands in run-time. You may try commands before writing the test.
203239

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

205242

206-
## GenerateFeature
207243

208-
Generates Feature file (in Gherkin):
244+
## GenerateSuite
209245

210-
* `codecept generate:feature suite Login`
211-
* `codecept g:feature suite subdir/subdir/login.feature`
212-
* `codecept g:feature suite login.feature -c path/to/project`
246+
Create new test suite. Requires suite name and actor name
213247

248+
* ``
249+
* `codecept g:suite api` -> api + ApiTester
250+
* `codecept g:suite integration Code` -> integration + CodeTester
251+
* `codecept g:suite frontend Front` -> frontend + FrontTester
214252

215253

216254

217-
## Clean
218255

219-
Recursively cleans `output` directory and generated code.
256+
## GenerateGroup
220257

221-
* `codecept clean`
258+
Creates empty GroupObject - extension which handles all group events.
222259

260+
* `codecept g:group Admin`
223261

224262

225263

@@ -233,56 +271,41 @@ Auto-updates phar archive from official site: 'https://codeception.com/codecept.
233271

234272

235273

236-
## GenerateEnvironment
237-
238-
Generates empty environment configuration file into envs dir:
239-
240-
* `codecept g:env firefox`
241-
242-
Required to have `envs` path to be specified in `codeception.yml`
243-
244-
245-
246-
## GenerateStepObject
247-
248-
Generates StepObject class. You will be asked for steps you want to implement.
249-
250-
* `codecept g:stepobject acceptance AdminSteps`
251-
* `codecept g:stepobject acceptance UserSteps --silent` - skip action questions
252-
253-
254-
255-
256-
## Init
274+
## Build
257275

276+
Generates Actor classes (initially Guy classes) from suite configs.
277+
Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
258278

279+
* `codecept build`
280+
* `codecept build path/to/project`
259281

260-
## GenerateSuite
261282

262-
Create new test suite. Requires suite name and actor name
263283

264-
* ``
265-
* `codecept g:suite api` -> api + ApiTester
266-
* `codecept g:suite integration Code` -> integration + CodeTester
267-
* `codecept g:suite frontend Front` -> frontend + FrontTester
268284

285+
## GenerateFeature
269286

287+
Generates Feature file (in Gherkin):
270288

289+
* `codecept generate:feature suite Login`
290+
* `codecept g:feature suite subdir/subdir/login.feature`
291+
* `codecept g:feature suite login.feature -c path/to/project`
271292

272-
## GenerateTest
273293

274-
Generates skeleton for Unit Test that extends `Codeception\TestCase\Test`.
275294

276-
* `codecept g:test unit User`
277-
* `codecept g:test unit "App\User"`
278295

296+
## Bootstrap
279297

298+
Creates default config, tests directory and sample suites for current project.
299+
Use this command to start building a test suite.
280300

281-
## Console
301+
By default, it will create 3 suites **Acceptance**, **Functional**, and **Unit**.
282302

283-
Try to execute test commands in run-time. You may try commands before writing the test.
303+
* `codecept bootstrap` - creates `tests` dir and `codeception.yml` in current dir.
304+
* `codecept bootstrap --empty` - creates `tests` dir without suites
305+
* `codecept bootstrap --namespace Frontend` - creates tests, and use `Frontend` namespace for actor classes and helpers.
306+
* `codecept bootstrap --actor Wizard` - sets actor as Wizard, to have `TestWizard` actor in tests.
307+
* `codecept bootstrap path/to/the/project` - provide different path to a project, where tests should be placed
284308

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

287310

288311

@@ -310,27 +333,4 @@ Check overriding config values (like in `run` command)
310333

311334

312335

313-
## Build
314-
315-
Generates Actor classes (initially Guy classes) from suite configs.
316-
Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
317-
318-
* `codecept build`
319-
* `codecept build path/to/project`
320-
321-
322-
323-
324-
325-
## DryRun
326-
327-
Shows step-by-step execution process for scenario driven tests without actually running them.
328-
329-
* `codecept dry-run acceptance`
330-
* `codecept dry-run acceptance MyCest`
331-
* `codecept dry-run acceptance checkout.feature`
332-
* `codecept dry-run tests/acceptance/MyCest.php`
333-
334-
335-
336336

0 commit comments

Comments
 (0)