@@ -5,22 +5,65 @@ title: Commands - Codeception - Documentation
55
66# Console Commands
77
8- ## SelfUpdate
8+ ## Build
99
10- Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar ' .
10+ Generates Actor classes (initially Guy classes) from suite configs.
11+ Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
1112
12- * ` php codecept.phar self-update `
13+ * ` codecept build `
14+ * ` codecept build path/to/project `
1315
14- @author Franck Cassedanne
< [email protected] > 1516
1617
1718
19+ ## Bootstrap
1820
19- ## GenerateGroup
21+ Creates default config, tests directory and sample suites for current project.
22+ Use this command to start building a test suite.
2023
21- Creates empty GroupObject - extension which handles all group events .
24+ By default it will create 3 suites ** Acceptance ** , ** Functional ** , and ** Unit ** .
2225
23- * ` codecept g:group Admin `
26+ * ` codecept bootstrap ` - creates ` tests ` dir and ` codeception.yml ` in current dir.
27+ * ` codecept bootstrap --empty ` - creates ` tests ` dir without suites
28+ * ` codecept bootstrap --namespace Frontend ` - creates tests, and use ` Frontend ` namespace for actor classes and helpers.
29+ * ` codecept bootstrap --actor Wizard ` - sets actor as Wizard, to have ` TestWizard ` actor in tests.
30+ * ` codecept bootstrap path/to/the/project ` - provide different path to a project, where tests should be placed
31+
32+
33+
34+
35+ ## GherkinSnippets
36+
37+ Generates code snippets for matched feature files in a suite.
38+ Code snippets are expected to be implemented in Actor or PageObjects
39+
40+ Usage:
41+
42+ * ` codecept gherkin:snippets acceptance ` - snippets from all feature of acceptance tests
43+ * ` codecept gherkin:snippets acceptance/feature/users ` - snippets from ` feature/users ` dir of acceptance tests
44+ * ` codecept gherkin:snippets acceptance user_account.feature ` - snippets from a single feature file
45+ * ` codecept gherkin:snippets acceptance/feature/users/user_accout.feature ` - snippets from feature file in a dir
46+
47+
48+
49+ ## GenerateFeature
50+
51+ Generates Feature file (in Gherkin):
52+
53+ * ` codecept generate:feature suite Login `
54+ * ` codecept g:feature suite subdir/subdir/login.feature `
55+ * ` codecept g:feature suite login.feature -c path/to/project `
56+
57+
58+
59+
60+ ## GenerateScenarios
61+
62+ Generates user-friendly text scenarios from scenario-driven tests (Cest).
63+
64+ * ` codecept g:scenarios acceptance ` - for all acceptance tests
65+ * ` codecept g:scenarios acceptance --format html ` - in html format
66+ * ` codecept g:scenarios acceptance --path doc ` - generate scenarios to ` doc ` dir
2467
2568
2669
@@ -48,58 +91,70 @@ Check overriding config values (like in `run` command)
4891
4992
5093
51- ## CompletionFallback
94+ ## GenerateTest
5295
96+ Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
5397
98+ * ` codecept g:test unit User `
99+ * ` codecept g:test unit "App\User" `
54100
55- ## Console
56101
57- Try to execute test commands in run-time. You may try commands before writing the test.
58102
59- * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
103+ ## GenerateSuite
60104
105+ Create new test suite. Requires suite name and actor name
61106
107+ * ``
108+ * ` codecept g:suite api ` -> api + ApiTester
109+ * ` codecept g:suite integration Code ` -> integration + CodeTester
110+ * ` codecept g:suite frontend Front ` -> frontend + FrontTester
62111
63- ## Build
64112
65- Generates Actor classes (initially Guy classes) from suite configs.
66- Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
67113
68- * ` codecept build `
69- * ` codecept build path/to/project `
70114
115+ ## GenerateStepObject
71116
117+ Generates StepObject class. You will be asked for steps you want to implement.
72118
119+ * ` codecept g:stepobject acceptance AdminSteps `
120+ * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
73121
74- ## GherkinSteps
75122
76- Prints all steps from all Gherkin contexts for a specific suite
77123
78- {% highlight yaml %}
79- codecept gherkin: steps acceptance
80124
81- {% endhighlight %}
125+ ## GeneratePageObject
82126
127+ Generates PageObject. Can be generated either globally, or just for one suite.
128+ If PageObject is generated globally it will act as UIMap, without any logic in it.
83129
130+ * ` codecept g:page Login `
131+ * ` codecept g:page Registration `
132+ * ` codecept g:page acceptance Login `
84133
85134
86- ## GenerateFeature
87135
88- Generates Feature file (in Gherkin):
136+ ## Console
89137
90- * ` codecept generate:feature suite Login `
91- * ` codecept g:feature suite subdir/subdir/login.feature `
92- * ` codecept g:feature suite login.feature -c path/to/project `
138+ Try to execute test commands in run-time. You may try commands before writing the test.
93139
140+ * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
94141
95142
96143
97- ## GenerateTest
144+ ## CompletionFallback
145+
146+
147+
148+ ## DryRun
149+
150+ Shows step by step execution process for scenario driven tests without actually running them.
151+
152+ * ` codecept dry-run acceptance `
153+ * ` codecept dry-run acceptance MyCest `
154+ * ` codecept dry-run acceptance checkout.feature `
155+ * ` codecept dry-run tests/acceptance/MyCest.php `
98156
99- Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
100157
101- * ` codecept g:test unit User `
102- * ` codecept g:test unit "App\User" `
103158
104159
105160
@@ -191,85 +246,43 @@ Options:
191246
192247
193248
194- ## GeneratePageObject
195-
196- Generates PageObject. Can be generated either globally, or just for one suite.
197- If PageObject is generated globally it will act as UIMap, without any logic in it.
198-
199- * ` codecept g:page Login `
200- * ` codecept g:page Registration `
201- * ` codecept g:page acceptance Login `
202-
203-
204-
205- ## Clean
206-
207- Recursively cleans ` output ` directory and generated code.
208-
209- * ` codecept clean `
210-
211-
212-
213-
214- ## GenerateStepObject
215-
216- Generates StepObject class. You will be asked for steps you want to implement.
217-
218- * ` codecept g:stepobject acceptance AdminSteps `
219- * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
220-
221-
222-
223-
224- ## GherkinSnippets
249+ ## GherkinSteps
225250
226- Generates code snippets for matched feature files in a suite.
227- Code snippets are expected to be implemented in Actor or PageObjects
251+ Prints all steps from all Gherkin contexts for a specific suite
228252
229- Usage:
253+ {% highlight yaml %}
254+ codecept gherkin: steps acceptance
230255
231- * ` codecept gherkin:snippets acceptance ` - snippets from all feature of acceptance tests
232- * ` codecept gherkin:snippets acceptance/feature/users ` - snippets from ` feature/users ` dir of acceptance tests
233- * ` codecept gherkin:snippets acceptance user_account.feature ` - snippets from a single feature file
234- * ` codecept gherkin:snippets acceptance/feature/users/user_accout.feature ` - snippets from feature file in a dir
256+ {% endhighlight %}
235257
236258
237259
238- ## GenerateCest
239260
240- Generates Cest (scenario-driven object-oriented test) file:
261+ ## GenerateEnvironment
241262
242- * ` codecept generate:cest suite Login `
243- * ` codecept g:cest suite subdir/subdir/testnameCest.php `
244- * ` codecept g:cest suite LoginCest -c path/to/project `
245- * ` codecept g:cest "App\Login" `
263+ Generates empty environment configuration file into envs dir:
246264
265+ * ` codecept g:env firefox `
247266
267+ Required to have ` envs ` path to be specified in ` codeception.yml `
248268
249269
250- ## Bootstrap
251270
252- Creates default config, tests directory and sample suites for current project.
253- Use this command to start building a test suite.
271+ ## GenerateGroup
254272
255- By default it will create 3 suites ** Acceptance ** , ** Functional ** , and ** Unit ** .
273+ Creates empty GroupObject - extension which handles all group events .
256274
257- * ` codecept bootstrap ` - creates ` tests ` dir and ` codeception.yml ` in current dir.
258- * ` codecept bootstrap --empty ` - creates ` tests ` dir without suites
259- * ` codecept bootstrap --namespace Frontend ` - creates tests, and use ` Frontend ` namespace for actor classes and helpers.
260- * ` codecept bootstrap --actor Wizard ` - sets actor as Wizard, to have ` TestWizard ` actor in tests.
261- * ` codecept bootstrap path/to/the/project ` - provide different path to a project, where tests should be placed
275+ * ` codecept g:group Admin `
262276
263277
264278
279+ ## SelfUpdate
265280
266- ## GenerateScenarios
281+ Auto-updates phar archive from official site: ' https://codeception.com/codecept.phar ' .
267282
268- Generates user-friendly text scenarios from scenario-driven tests (Cest).
283+ * ` php codecept.phar self-update `
269284
270- * ` codecept g:scenarios acceptance ` - for all acceptance tests
271- * ` codecept g:scenarios acceptance --format html ` - in html format
272- * ` codecept g:scenarios acceptance --path doc ` - generate scenarios to ` doc ` dir
285+ @author Franck Cassedanne
< [email protected] > 273286
274287
275288
@@ -283,29 +296,16 @@ Creates empty Helper class.
283296
284297
285298
286- ## GenerateSuite
287-
288- Create new test suite. Requires suite name and actor name
289-
290- * ``
291- * ` codecept g:suite api ` -> api + ApiTester
292- * ` codecept g:suite integration Code ` -> integration + CodeTester
293- * ` codecept g:suite frontend Front ` -> frontend + FrontTester
294-
295-
296-
297-
298299## Init
299300
300301
301302
302- ## GenerateEnvironment
303+ ## Clean
303304
304- Generates empty environment configuration file into envs dir:
305+ Recursively cleans ` output ` directory and generated code.
305306
306- * ` codecept g:env firefox `
307+ * ` codecept clean `
307308
308- Required to have ` envs ` path to be specified in ` codeception.yml `
309309
310310
311311
@@ -321,14 +321,14 @@ If suite name is provided, an actor class will be included into placeholder
321321
322322
323323
324- ## DryRun
324+ ## GenerateCest
325325
326- Shows step by step execution process for scenario driven tests without actually running them.
326+ Generates Cest ( scenario- driven object-oriented test) file:
327327
328- * ` codecept dry-run acceptance `
329- * ` codecept dry-run acceptance MyCest `
330- * ` codecept dry-run acceptance checkout.feature `
331- * ` codecept dry-run tests/acceptance/MyCest.php `
328+ * ` codecept generate:cest suite Login `
329+ * ` codecept g:cest suite subdir/subdir/testnameCest.php `
330+ * ` codecept g:cest suite LoginCest -c path/to/project `
331+ * ` codecept g:cest "App\Login" `
332332
333333
334334
0 commit comments