@@ -5,6 +5,66 @@ title: Commands - Codeception - Documentation
55
66# Console Commands
77
8+
9+ ## GenerateFeature
10+
11+ Generates Feature file (in Gherkin):
12+
13+ * ` codecept generate:feature suite Login `
14+ * ` codecept g:feature suite subdir/subdir/login.feature `
15+ * ` codecept g:feature suite login.feature -c path/to/project `
16+
17+
18+
19+
20+ ## GenerateSnapshot
21+
22+ Generates Snapshot.
23+ Snapshot can be used to test dynamical data.
24+ If suite name is provided, an actor class will be included into placeholder
25+
26+ * ` codecept g:snapshot UserEmails `
27+ * ` codecept g:snapshot Products `
28+ * ` codecept g:snapshot Acceptance UserEmails `
29+
30+
31+
32+ ## CompletionFallback
33+
34+
35+
36+ ## ConfigValidate
37+
38+ Validates and prints Codeception config.
39+ Use it do debug Yaml configs
40+
41+ Check config:
42+
43+ * ` codecept config ` : check global config
44+ * ` codecept config Unit ` : check suite config
45+
46+ Load config:
47+
48+ * ` codecept config:validate -c path/to/another/config ` : from another dir
49+ * ` codecept config:validate -c another_config.yml ` : from another config file
50+
51+ Check overriding config values (like in ` run ` command)
52+
53+ * ` codecept config:validate -o "settings: shuffle: true" ` : enable shuffle
54+ * ` codecept config:validate -o "settings: lint: false" ` : disable linting
55+ * ` codecept config:validate -o "reporters: report: \Custom\Reporter" --report ` : use custom reporter
56+
57+
58+
59+
60+ ## Console
61+
62+ Try to execute test commands in run-time. You may try commands before writing the test.
63+
64+ * ` codecept console Acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
65+
66+
67+
868## GenerateHelper
969
1070Creates empty Helper class.
@@ -14,6 +74,59 @@ Creates empty Helper class.
1474
1575
1676
77+ ## DryRun
78+
79+ Shows step-by-step execution process for scenario driven tests without actually running them.
80+
81+ * ` codecept dry-run Acceptance `
82+ * ` codecept dry-run Acceptance MyCest `
83+ * ` codecept dry-run Acceptance checkout.feature `
84+ * ` codecept dry-run tests/Acceptance/MyCest.php `
85+
86+
87+
88+
89+ ## GenerateScenarios
90+
91+ Generates user-friendly text scenarios from scenario-driven tests (Cest).
92+
93+ * ` codecept g:scenarios Acceptance ` - for all acceptance tests
94+ * ` codecept g:scenarios Acceptance --format html ` - in html format
95+ * ` codecept g:scenarios Acceptance --path doc ` - generate scenarios to ` doc ` dir
96+
97+
98+
99+ ## GeneratePageObject
100+
101+ Generates PageObject. Can be generated either globally, or just for one suite.
102+ If PageObject is generated globally it will act as UIMap, without any logic in it.
103+
104+ * ` codecept g:page Login `
105+ * ` codecept g:page Registration `
106+ * ` codecept g:page Acceptance Login `
107+
108+
109+
110+ ## GenerateSuite
111+
112+ Create new test suite. Requires suite name and actor name
113+
114+ * ``
115+ * ` codecept g:suite Api ` -> api + ApiTester
116+ * ` codecept g:suite Integration Code ` -> integration + CodeTester
117+ * ` codecept g:suite Frontend Front ` -> frontend + FrontTester
118+
119+
120+
121+
122+ ## GenerateGroup
123+
124+ Creates empty GroupObject - extension which handles all group events.
125+
126+ * ` codecept g:group Admin `
127+
128+
129+
17130## GenerateTest
18131
19132Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
@@ -23,13 +136,28 @@ Generates skeleton for Unit Test that extends `Codeception\TestCase\Test`.
23136
24137
25138
26- ## Build
139+ ## SelfUpdate
27140
28- Generates Actor classes (initially Guy classes) from suite configs.
29- Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
141+ Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar ' .
30142
31- * ` codecept build `
32- * ` codecept build path/to/project `
143+ * ` php codecept.phar self-update `
144+
145+ @author Franck Cassedanne
< [email protected] > 146+
147+
148+
149+ ## Bootstrap
150+
151+ Creates default config, tests directory and sample suites for current project.
152+ Use this command to start building a test suite.
153+
154+ By default, it will create 3 suites ** Acceptance** , ** Functional** , and ** Unit** .
155+
156+ * ` codecept bootstrap ` - creates ` tests ` dir and ` codeception.yml ` in current dir.
157+ * ` codecept bootstrap --empty ` - creates ` tests ` dir without suites
158+ * ` codecept bootstrap --namespace Frontend ` - creates tests, and use ` Frontend ` namespace for actor classes and helpers.
159+ * ` codecept bootstrap --actor Wizard ` - sets actor as Wizard, to have ` TestWizard ` actor in tests.
160+ * ` codecept bootstrap path/to/the/project ` - provide different path to a project, where tests should be placed
33161
34162
35163
@@ -48,26 +176,24 @@ Usage:
48176
49177
50178
51- ## ConfigValidate
179+ ## GenerateStepObject
52180
53- Validates and prints Codeception config.
54- Use it do debug Yaml configs
181+ Generates StepObject class. You will be asked for steps you want to implement.
55182
56- Check config:
183+ * ` codecept g:stepobject Acceptance AdminSteps `
184+ * ` codecept g:stepobject Acceptance UserSteps --silent ` - skip action questions
57185
58- * ` codecept config ` : check global config
59- * ` codecept config Unit ` : check suite config
60186
61- Load config:
62187
63- * ` codecept config:validate -c path/to/another/config ` : from another dir
64- * ` codecept config:validate -c another_config.yml ` : from another config file
65188
66- Check overriding config values (like in ` run ` command)
189+ ## GenerateCest
67190
68- * ` codecept config:validate -o "settings: shuffle: true" ` : enable shuffle
69- * ` codecept config:validate -o "settings: lint: false" ` : disable linting
70- * ` codecept config:validate -o "reporters: report: \Custom\Reporter" --report ` : use custom reporter
191+ Generates Cest (scenario-driven object-oriented test) file:
192+
193+ * ` codecept generate:cest suite Login `
194+ * ` codecept g:cest suite subdir/subdir/testnameCest.php `
195+ * ` codecept g:cest suite LoginCest -c path/to/project `
196+ * ` codecept g:cest "App\Login" `
71197
72198
73199
@@ -165,14 +291,13 @@ Options:
165291
166292
167293
168- ## GenerateSuite
294+ ## Build
169295
170- Create new test suite. Requires suite name and actor name
296+ Generates Actor classes (initially Guy classes) from suite configs.
297+ Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
171298
172- * ``
173- * ` codecept g:suite Api ` -> api + ApiTester
174- * ` codecept g:suite Integration Code ` -> integration + CodeTester
175- * ` codecept g:suite Frontend Front ` -> frontend + FrontTester
299+ * ` codecept build `
300+ * ` codecept build path/to/project `
176301
177302
178303
@@ -186,7 +311,6 @@ Recursively cleans `output` directory and generated code.
186311
187312
188313
189-
190314## GenerateEnvironment
191315
192316Generates empty environment configuration file into envs dir:
@@ -201,107 +325,6 @@ Required to have `envs` path to be specified in `codeception.yml`
201325
202326
203327
204- ## Console
205-
206- Try to execute test commands in run-time. You may try commands before writing the test.
207-
208- * ` codecept console Acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
209-
210-
211-
212- ## SelfUpdate
213-
214- Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar ' .
215-
216- * ` php codecept.phar self-update `
217-
218- @author Franck Cassedanne
< [email protected] > 219-
220-
221-
222- ## Bootstrap
223-
224- Creates default config, tests directory and sample suites for current project.
225- Use this command to start building a test suite.
226-
227- By default, it will create 3 suites ** Acceptance** , ** Functional** , and ** Unit** .
228-
229- * ` codecept bootstrap ` - creates ` tests ` dir and ` codeception.yml ` in current dir.
230- * ` codecept bootstrap --empty ` - creates ` tests ` dir without suites
231- * ` codecept bootstrap --namespace Frontend ` - creates tests, and use ` Frontend ` namespace for actor classes and helpers.
232- * ` codecept bootstrap --actor Wizard ` - sets actor as Wizard, to have ` TestWizard ` actor in tests.
233- * ` codecept bootstrap path/to/the/project ` - provide different path to a project, where tests should be placed
234-
235-
236-
237-
238- ## GenerateStepObject
239-
240- Generates StepObject class. You will be asked for steps you want to implement.
241-
242- * ` codecept g:stepobject Acceptance AdminSteps `
243- * ` codecept g:stepobject Acceptance UserSteps --silent ` - skip action questions
244-
245-
246-
247-
248- ## DryRun
249-
250- Shows step-by-step execution process for scenario driven tests without actually running them.
251-
252- * ` codecept dry-run Acceptance `
253- * ` codecept dry-run Acceptance MyCest `
254- * ` codecept dry-run Acceptance checkout.feature `
255- * ` codecept dry-run tests/Acceptance/MyCest.php `
256-
257-
258-
259-
260- ## GenerateSnapshot
261-
262- Generates Snapshot.
263- Snapshot can be used to test dynamical data.
264- If suite name is provided, an actor class will be included into placeholder
265-
266- * ` codecept g:snapshot UserEmails `
267- * ` codecept g:snapshot Products `
268- * ` codecept g:snapshot Acceptance UserEmails `
269-
270-
271-
272- ## CompletionFallback
273-
274-
275-
276- ## GenerateScenarios
277-
278- Generates user-friendly text scenarios from scenario-driven tests (Cest).
279-
280- * ` codecept g:scenarios Acceptance ` - for all acceptance tests
281- * ` codecept g:scenarios Acceptance --format html ` - in html format
282- * ` codecept g:scenarios Acceptance --path doc ` - generate scenarios to ` doc ` dir
283-
284-
285-
286- ## GenerateGroup
287-
288- Creates empty GroupObject - extension which handles all group events.
289-
290- * ` codecept g:group Admin `
291-
292-
293-
294- ## GeneratePageObject
295-
296- Generates PageObject. Can be generated either globally, or just for one suite.
297- If PageObject is generated globally it will act as UIMap, without any logic in it.
298-
299- * ` codecept g:page Login `
300- * ` codecept g:page Registration `
301- * ` codecept g:page Acceptance Login `
302-
303-
304-
305328## GherkinSteps
306329
307330Prints all steps from all Gherkin contexts for a specific suite
@@ -313,26 +336,3 @@ codecept gherkin:steps Acceptance
313336
314337
315338
316- ## GenerateCest
317-
318- Generates Cest (scenario-driven object-oriented test) file:
319-
320- * ` codecept generate:cest suite Login `
321- * ` codecept g:cest suite subdir/subdir/testnameCest.php `
322- * ` codecept g:cest suite LoginCest -c path/to/project `
323- * ` codecept g:cest "App\Login" `
324-
325-
326-
327-
328- ## GenerateFeature
329-
330- Generates Feature file (in Gherkin):
331-
332- * ` codecept generate:feature suite Login `
333- * ` codecept g:feature suite subdir/subdir/login.feature `
334- * ` codecept g:feature suite login.feature -c path/to/project `
335-
336-
337-
338-
0 commit comments