@@ -5,35 +5,15 @@ 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-
8+ ## GherkinSteps
269
10+ Prints all steps from all Gherkin contexts for a specific suite
2711
28- ## GenerateSnapshot
12+ {% highlight yaml %}
13+ codecept gherkin: steps acceptance
2914
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
15+ {% endhighlight %}
3316
34- * ` codecept g:snapshot UserEmails `
35- * ` codecept g:snapshot Products `
36- * ` codecept g:snapshot acceptance UserEmails `
3717
3818
3919
@@ -49,57 +29,46 @@ Shows step-by-step execution process for scenario driven tests without actually
4929
5030
5131
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" `
32+ ## Init
5833
5934
6035
61- ## GenerateHelper
62-
63- Creates empty Helper class.
36+ ## GenerateCest
6437
65- * ` codecept g:helper MyHelper `
66- * ` codecept g:helper "My\Helper" `
38+ Generates Cest (scenario-driven object-oriented test) file:
6739
40+ * ` codecept generate:cest suite Login `
41+ * ` codecept g:cest suite subdir/subdir/testnameCest.php `
42+ * ` codecept g:cest suite LoginCest -c path/to/project `
43+ * ` codecept g:cest "App\Login" `
6844
6945
7046
71- ## GherkinSnippets
7247
73- Generates code snippets for matched feature files in a suite.
74- Code snippets are expected to be implemented in Actor or PageObjects
48+ ## SelfUpdate
7549
76- Usage:
50+ Auto-updates phar archive from official site: ' https://codeception.com/codecept.phar ' .
7751
78- * ` codecept gherkin:snippets acceptance ` - snippets from all feature of acceptance tests
79- * ` codecept gherkin:snippets acceptance/feature/users ` - snippets from ` feature/users ` dir of acceptance tests
80- * ` codecept gherkin:snippets acceptance user_account.feature ` - snippets from a single feature file
81- * ` codecept gherkin:snippets acceptance/feature/users/user_accout.feature ` - snippets from feature file in a dir
52+ * ` php codecept.phar self-update `
8253
54+ @author Franck Cassedanne
< [email protected] > 8355
8456
85- ## GeneratePageObject
8657
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.
58+ ## GenerateTest
8959
90- * ` codecept g:page Login `
91- * ` codecept g:page Registration `
92- * ` codecept g:page acceptance Login `
60+ Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
9361
62+ * ` codecept g:test unit User `
63+ * ` codecept g:test unit "App\User" `
9464
9565
96- ## GenerateEnvironment
9766
98- Generates empty environment configuration file into envs dir:
67+ ## GenerateGroup
9968
100- * ` codecept g:env firefox `
69+ Creates empty GroupObject - extension which handles all group events.
10170
102- Required to have ` envs ` path to be specified in ` codeception.yml `
71+ * ` codecept g:group Admin `
10372
10473
10574
@@ -196,140 +165,171 @@ Options:
196165
197166
198167
199- ## GherkinSteps
168+ ## GenerateStepObject
200169
201- Prints all steps from all Gherkin contexts for a specific suite
170+ Generates StepObject class. You will be asked for steps you want to implement.
202171
203- {% highlight yaml %}
204- codecept gherkin : steps acceptance
172+ * ` codecept g:stepobject acceptance AdminSteps `
173+ * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
205174
206- {% endhighlight %}
207175
208176
209177
178+ ## GenerateSnapshot
210179
211- ## Clean
180+ Generates Snapshot.
181+ Snapshot can be used to test dynamical data.
182+ If suite name is provided, an actor class will be included into placeholder
212183
213- Recursively cleans ` output ` directory and generated code.
184+ * ` codecept g:snapshot UserEmails `
185+ * ` codecept g:snapshot Products `
186+ * ` codecept g:snapshot acceptance UserEmails `
214187
215- * ` codecept clean `
216188
217189
190+ ## GenerateScenarios
218191
192+ Generates user-friendly text scenarios from scenario-driven tests (Cest).
219193
220- ## Init
194+ * ` codecept g:scenarios acceptance ` - for all acceptance tests
195+ * ` codecept g:scenarios acceptance --format html ` - in html format
196+ * ` codecept g:scenarios acceptance --path doc ` - generate scenarios to ` doc ` dir
221197
222198
223199
224- ## GenerateCest
200+ ## GeneratePageObject
225201
226- Generates Cest (scenario-driven object-oriented test) file:
202+ Generates PageObject. Can be generated either globally, or just for one suite.
203+ If PageObject is generated globally it will act as UIMap, without any logic in it.
227204
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" `
205+ * ` codecept g:page Login `
206+ * ` codecept g:page Registration `
207+ * ` codecept g:page acceptance Login `
232208
233209
234210
211+ ## ConfigValidate
235212
236- ## Console
213+ Validates and prints Codeception config.
214+ Use it do debug Yaml configs
237215
238- Try to execute test commands in run-time. You may try commands before writing the test.
216+ Check config:
239217
240- * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
218+ * ` codecept config ` : check global config
219+ * ` codecept config unit ` : check suite config
241220
221+ Load config:
242222
223+ * ` codecept config:validate -c path/to/another/config ` : from another dir
224+ * ` codecept config:validate -c another_config.yml ` : from another config file
243225
244- ## GenerateSuite
226+ Check overriding config values (like in ` run ` command)
245227
246- Create new test suite. Requires suite name and actor name
228+ * ` codecept config:validate -o "settings: shuffle: true" ` : enable shuffle
229+ * ` codecept config:validate -o "settings: lint: false" ` : disable linting
230+ * ` codecept config:validate -o "reporters: report: \Custom\Reporter" --report ` : use custom reporter
247231
248- * ``
249- * ` codecept g:suite api ` -> api + ApiTester
250- * ` codecept g:suite integration Code ` -> integration + CodeTester
251- * ` codecept g:suite frontend Front ` -> frontend + FrontTester
252232
253233
254234
235+ ## GenerateHelper
255236
256- ## GenerateGroup
237+ Creates empty Helper class.
257238
258- Creates empty GroupObject - extension which handles all group events.
239+ * ` codecept g:helper MyHelper `
240+ * ` codecept g:helper "My\Helper" `
259241
260- * ` codecept g:group Admin `
261242
262243
263244
264- ## SelfUpdate
245+ ## Bootstrap
265246
266- Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar ' .
247+ Creates default config, tests directory and sample suites for current project.
248+ Use this command to start building a test suite.
267249
268- * ` php codecept.phar self-update `
250+ By default, it will create 3 suites ** Acceptance ** , ** Functional ** , and ** Unit ** .
269251
270- @author Franck Cassedanne
< [email protected] > 252+ * ` codecept bootstrap ` - creates ` tests ` dir and ` codeception.yml ` in current dir.
253+ * ` codecept bootstrap --empty ` - creates ` tests ` dir without suites
254+ * ` codecept bootstrap --namespace Frontend ` - creates tests, and use ` Frontend ` namespace for actor classes and helpers.
255+ * ` codecept bootstrap --actor Wizard ` - sets actor as Wizard, to have ` TestWizard ` actor in tests.
256+ * ` codecept bootstrap path/to/the/project ` - provide different path to a project, where tests should be placed
271257
272258
273259
274- ## Build
275260
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.
261+ ## GenerateEnvironment
278262
279- * ` codecept build `
280- * ` codecept build path/to/project `
263+ Generates empty environment configuration file into envs dir:
281264
265+ * ` codecept g:env firefox `
282266
267+ Required to have ` envs ` path to be specified in ` codeception.yml `
283268
284269
285- ## GenerateFeature
286270
287- Generates Feature file (in Gherkin):
271+ ## Console
288272
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 `
273+ Try to execute test commands in run-time. You may try commands before writing the test.
292274
275+ * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
293276
294277
295278
296- ## Bootstrap
279+ ## GenerateSuite
297280
298- Creates default config, tests directory and sample suites for current project.
299- Use this command to start building a test suite.
281+ Create new test suite. Requires suite name and actor name
300282
301- By default, it will create 3 suites ** Acceptance** , ** Functional** , and ** Unit** .
283+ * ``
284+ * ` codecept g:suite api ` -> api + ApiTester
285+ * ` codecept g:suite integration Code ` -> integration + CodeTester
286+ * ` codecept g:suite frontend Front ` -> frontend + FrontTester
302287
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
308288
309289
310290
291+ ## Build
311292
312- ## ConfigValidate
293+ Generates Actor classes (initially Guy classes) from suite configs.
294+ Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
313295
314- Validates and prints Codeception config.
315- Use it do debug Yaml configs
296+ * ` codecept build `
297+ * ` codecept build path/to/project `
316298
317- Check config:
318299
319- * ` codecept config ` : check global config
320- * ` codecept config unit ` : check suite config
321300
322- Load config:
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
302+ ## Clean
326303
327- Check overriding config values (like in ` run ` command)
304+ Recursively cleans ` output ` directory and generated code.
328305
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
306+ * ` codecept clean `
307+
308+
309+
310+
311+
312+ ## GherkinSnippets
313+
314+ Generates code snippets for matched feature files in a suite.
315+ Code snippets are expected to be implemented in Actor or PageObjects
316+
317+ Usage:
332318
319+ * ` codecept gherkin:snippets acceptance ` - snippets from all feature of acceptance tests
320+ * ` codecept gherkin:snippets acceptance/feature/users ` - snippets from ` feature/users ` dir of acceptance tests
321+ * ` codecept gherkin:snippets acceptance user_account.feature ` - snippets from a single feature file
322+ * ` codecept gherkin:snippets acceptance/feature/users/user_accout.feature ` - snippets from feature file in a dir
323+
324+
325+
326+ ## GenerateFeature
327+
328+ Generates Feature file (in Gherkin):
329+
330+ * ` codecept generate:feature suite Login `
331+ * ` codecept g:feature suite subdir/subdir/login.feature `
332+ * ` codecept g:feature suite login.feature -c path/to/project `
333333
334334
335335
0 commit comments