@@ -5,25 +5,12 @@ title: Commands - Codeception - Documentation
55
66# Console Commands
77
8- ## DryRun
9-
10- Shows step-by-step execution process for scenario driven tests without actually running them.
11-
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`
16-
17-
18-
19-
20- ## Build
8+ ## GenerateStepObject
219
22- Generates Actor classes (initially Guy classes) from suite configs.
23- Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
10+ Generates StepObject class. You will be asked for steps you want to implement.
2411
25- * `codecept build `
26- * `codecept build path/to/project`
12+ * `codecept g:stepobject acceptance AdminSteps `
13+ * `codecept g:stepobject acceptance UserSteps --silent` - skip action questions
2714
2815
2916
@@ -38,93 +25,36 @@ Generates user-friendly text scenarios from scenario-driven tests (Cest).
3825
3926
4027
28+ ## GenerateSnapshot
4129
42- ## ConfigValidate
43-
44- Validates and prints Codeception config.
45- Use it do debug Yaml configs
46-
47- Check config:
48-
49- * `codecept config`: check global config
50- * `codecept config unit`: check suite config
51-
52- Load config:
53-
54- * `codecept config:validate -c path/to/another/config`: from another dir
55- * `codecept config:validate -c another_config.yml`: from another config file
56-
57- Check overriding config values (like in `run` command)
58-
59- * `codecept config:validate -o "settings: shuffle: true"`: enable shuffle
60- * `codecept config:validate -o "settings: lint: false"`: disable linting
61- * `codecept config:validate -o "reporters: report: \Custom\Reporter" --report`: use custom reporter
62-
63-
64-
65-
66- ## GenerateFeature
67-
68- Generates Feature file (in Gherkin):
69-
70- * `codecept generate:feature suite Login`
71- * `codecept g:feature suite subdir/subdir/login.feature`
72- * `codecept g:feature suite login.feature -c path/to/project`
73-
74-
75-
76-
77- ## GherkinSteps
78-
79- Prints all steps from all Gherkin contexts for a specific suite
80-
81- {% highlight yaml %}
82- codecept gherkin:steps acceptance
83-
84- {% endhighlight %}
85-
86-
87-
88-
89- ## GeneratePageObject
90-
91- Generates PageObject. Can be generated either globally, or just for one suite.
92- If PageObject is generated globally it will act as UIMap, without any logic in it.
93-
94- * `codecept g:page Login`
95- * `codecept g:page Registration`
96- * `codecept g:page acceptance Login`
97-
98-
99-
100- ## GenerateEnvironment
101-
102- Generates empty environment configuration file into envs dir:
103-
104- * `codecept g:env firefox`
105-
106- Required to have `envs` path to be specified in `codeception.yml`
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
10733
34+ * `codecept g:snapshot UserEmails`
35+ * `codecept g:snapshot Products`
36+ * `codecept g:snapshot acceptance UserEmails`
10837
10938
110- ## GenerateCest
11139
112- Generates Cest (scenario-driven object-oriented test) file:
40+ ## DryRun
11341
114- * `codecept generate:cest suite Login`
115- * `codecept g:cest suite subdir/subdir/testnameCest.php`
116- * `codecept g:cest suite LoginCest -c path/to/project`
117- * `codecept g:cest "App\Login"`
42+ Shows step-by-step execution process for scenario driven tests without actually running them.
11843
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`
11948
12049
12150
122- ## Clean
12351
124- Recursively cleans `output` directory and generated code.
52+ ## GenerateTest
12553
126- * `codecept clean`
54+ Generates skeleton for Unit Test that extends `Codeception\TestCase\Test`.
12755
56+ * `codecept g:test unit User`
57+ * `codecept g:test unit "App\User"`
12858
12959
13060
@@ -138,42 +68,6 @@ Creates empty Helper class.
13868
13969
14070
141- ## GenerateSuite
142-
143- Create new test suite. Requires suite name and actor name
144-
145- * ``
146- * `codecept g:suite api` -> api + ApiTester
147- * `codecept g:suite integration Code` -> integration + CodeTester
148- * `codecept g:suite frontend Front` -> frontend + FrontTester
149-
150-
151-
152-
153- ## Console
154-
155- Try to execute test commands in run-time. You may try commands before writing the test.
156-
157- * `codecept console acceptance` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
158-
159-
160-
161- ## GenerateSnapshot
162-
163- Generates Snapshot.
164- Snapshot can be used to test dynamical data.
165- If suite name is provided, an actor class will be included into placeholder
166-
167- * `codecept g:snapshot UserEmails`
168- * `codecept g:snapshot Products`
169- * `codecept g:snapshot acceptance UserEmails`
170-
171-
172-
173- ## Init
174-
175-
176-
17771## GherkinSnippets
17872
17973Generates code snippets for matched feature files in a suite.
@@ -188,42 +82,24 @@ Usage:
18882
18983
19084
191- ## GenerateStepObject
192-
193- Generates StepObject class. You will be asked for steps you want to implement.
194-
195- * `codecept g:stepobject acceptance AdminSteps`
196- * `codecept g:stepobject acceptance UserSteps --silent` - skip action questions
197-
198-
199-
200-
201- ## CompletionFallback
202-
203-
204-
205- ## GenerateTest
206-
207- Generates skeleton for Unit Test that extends `Codeception\TestCase\Test`.
85+ ## GeneratePageObject
20886
209- * `codecept g:test unit User`
210- * `codecept g:test unit "App\User"`
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.
21189
90+ * `codecept g:page Login`
91+ * `codecept g:page Registration`
92+ * `codecept g:page acceptance Login`
21293
21394
214- ## Bootstrap
21595
216- Creates default config, tests directory and sample suites for current project.
217- Use this command to start building a test suite.
96+ ## GenerateEnvironment
21897
219- By default, it will create 3 suites **Acceptance**, **Functional**, and **Unit**.
98+ Generates empty environment configuration file into envs dir:
22099
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
100+ * `codecept g:env firefox`
226101
102+ Required to have `envs` path to be specified in `codeception.yml`
227103
228104
229105
@@ -316,6 +192,75 @@ Options:
316192
317193
318194
195+ ## CompletionFallback
196+
197+
198+
199+ ## GherkinSteps
200+
201+ Prints all steps from all Gherkin contexts for a specific suite
202+
203+ {% highlight yaml %}
204+ codecept gherkin:steps acceptance
205+
206+ {% endhighlight %}
207+
208+
209+
210+
211+ ## Clean
212+
213+ Recursively cleans `output` directory and generated code.
214+
215+ * `codecept clean`
216+
217+
218+
219+
220+ ## Init
221+
222+
223+
224+ ## GenerateCest
225+
226+ Generates Cest (scenario-driven object-oriented test) file:
227+
228+ * `codecept generate:cest suite Login`
229+ * `codecept g:cest suite subdir/subdir/testnameCest.php`
230+ * `codecept g:cest suite LoginCest -c path/to/project`
231+ * `codecept g:cest "App\Login"`
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+
244+ ## GenerateSuite
245+
246+ Create new test suite. Requires suite name and actor name
247+
248+ * ``
249+ * `codecept g:suite api` -> api + ApiTester
250+ * `codecept g:suite integration Code` -> integration + CodeTester
251+ * `codecept g:suite frontend Front` -> frontend + FrontTester
252+
253+
254+
255+
256+ ## GenerateGroup
257+
258+ Creates empty GroupObject - extension which handles all group events.
259+
260+ * `codecept g:group Admin`
261+
262+
263+
319264## SelfUpdate
320265
321266Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar' .
@@ -326,11 +271,66 @@ Auto-updates phar archive from official site: 'https://codeception.com/codecept.
326271
327272
328273
329- ## GenerateGroup
274+ ## Build
275+
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.
278+
279+ * `codecept build`
280+ * `codecept build path/to/project`
281+
282+
283+
284+
285+ ## GenerateFeature
286+
287+ Generates Feature file (in Gherkin):
288+
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`
292+
293+
294+
295+
296+ ## Bootstrap
297+
298+ Creates default config, tests directory and sample suites for current project.
299+ Use this command to start building a test suite.
300+
301+ By default, it will create 3 suites **Acceptance**, **Functional**, and **Unit**.
302+
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
308+
309+
310+
311+
312+ ## ConfigValidate
313+
314+ Validates and prints Codeception config.
315+ Use it do debug Yaml configs
316+
317+ Check config:
318+
319+ * `codecept config`: check global config
320+ * `codecept config unit`: check suite config
321+
322+ Load config:
323+
324+ * `codecept config:validate -c path/to/another/config`: from another dir
325+ * `codecept config:validate -c another_config.yml`: from another config file
326+
327+ Check overriding config values (like in `run` command)
328+
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
330332
331- Creates empty GroupObject - extension which handles all group events.
332333
333- * `codecept g:group Admin`
334334
335335
336336
0 commit comments