@@ -5,6 +5,34 @@ 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+
836## ConfigValidate
937
1038Validates and prints Codeception config.
@@ -29,35 +57,82 @@ Check overriding config values (like in `run` command)
2957
3058
3159
32- ## GenerateSnapshot
60+ ## Console
3361
34- Generates Snapshot.
35- Snapshot can be used to test dynamical data.
36- If suite name is provided, an actor class will be included into placeholder
62+ Try to execute test commands in run-time. You may try commands before writing the test.
3763
38- * ` codecept g:snapshot UserEmails `
39- * ` codecept g:snapshot Products `
40- * ` codecept g:snapshot Acceptance UserEmails `
64+ * ` codecept console Acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
4165
4266
4367
44- ## Bootstrap
68+ ## GenerateHelper
4569
46- Creates default config, tests directory and sample suites for current project.
47- Use this command to start building a test suite.
70+ Creates empty Helper class.
4871
49- By default, it will create 3 suites ** Acceptance** , ** Functional** , and ** Unit** .
72+ * ` codecept g:helper MyHelper `
73+ * ` codecept g:helper "My\Helper" `
5074
51- * ` codecept bootstrap ` - creates ` tests ` dir and ` codeception.yml ` in current dir.
52- * ` codecept bootstrap --empty ` - creates ` tests ` dir without suites
53- * ` codecept bootstrap --namespace Frontend ` - creates tests, and use ` Frontend ` namespace for actor classes and helpers.
54- * ` codecept bootstrap --actor Wizard ` - sets actor as Wizard, to have ` TestWizard ` actor in tests.
55- * ` codecept bootstrap path/to/the/project ` - provide different path to a project, where tests should be placed
5675
5776
77+ ## DryRun
5878
79+ Shows step-by-step execution process for scenario driven tests without actually running them.
5980
60- ## CompletionFallback
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+
130+ ## GenerateTest
131+
132+ Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
133+
134+ * ` codecept g:test Unit User `
135+ * ` codecept g:test Unit "App\User" `
61136
62137
63138
@@ -71,12 +146,18 @@ Auto-updates phar archive from official site: 'https://codeception.com/codecept.
71146
72147
73148
74- ## GenerateStepObject
149+ ## Bootstrap
75150
76- Generates StepObject class. You will be asked for steps you want to implement.
151+ Creates default config, tests directory and sample suites for current project.
152+ Use this command to start building a test suite.
77153
78- * ` codecept g:stepobject Acceptance AdminSteps `
79- * ` codecept g:stepobject Acceptance UserSteps --silent ` - skip action questions
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
80161
81162
82163
@@ -95,6 +176,28 @@ Usage:
95176
96177
97178
179+ ## GenerateStepObject
180+
181+ Generates StepObject class. You will be asked for steps you want to implement.
182+
183+ * ` codecept g:stepobject Acceptance AdminSteps `
184+ * ` codecept g:stepobject Acceptance UserSteps --silent ` - skip action questions
185+
186+
187+
188+
189+ ## GenerateCest
190+
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" `
197+
198+
199+
200+
98201## Run
99202
100203Executes tests.
@@ -188,12 +291,14 @@ Options:
188291
189292
190293
191- ## GenerateTest
294+ ## Build
192295
193- Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
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.
298+
299+ * ` codecept build `
300+ * ` codecept build path/to/project `
194301
195- * ` codecept g:test Unit User `
196- * ` codecept g:test Unit "App\User" `
197302
198303
199304
@@ -206,96 +311,6 @@ Recursively cleans `output` directory and generated code.
206311
207312
208313
209- ## DryRun
210-
211- Shows step-by-step execution process for scenario driven tests without actually running them.
212-
213- * ` codecept dry-run Acceptance `
214- * ` codecept dry-run Acceptance MyCest `
215- * ` codecept dry-run Acceptance checkout.feature `
216- * ` codecept dry-run tests/Acceptance/MyCest.php `
217-
218-
219-
220-
221- ## GenerateGroup
222-
223- Creates empty GroupObject - extension which handles all group events.
224-
225- * ` codecept g:group Admin `
226-
227-
228-
229-
230- ## GenerateCest
231-
232- Generates Cest (scenario-driven object-oriented test) file:
233-
234- * ` codecept generate:cest suite Login `
235- * ` codecept g:cest suite subdir/subdir/testnameCest.php `
236- * ` codecept g:cest suite LoginCest -c path/to/project `
237- * ` codecept g:cest "App\Login" `
238-
239-
240-
241-
242- ## GenerateFeature
243-
244- Generates Feature file (in Gherkin):
245-
246- * ` codecept generate:feature suite Login `
247- * ` codecept g:feature suite subdir/subdir/login.feature `
248- * ` codecept g:feature suite login.feature -c path/to/project `
249-
250-
251-
252-
253- ## GeneratePageObject
254-
255- Generates PageObject. Can be generated either globally, or just for one suite.
256- If PageObject is generated globally it will act as UIMap, without any logic in it.
257-
258- * ` codecept g:page Login `
259- * ` codecept g:page Registration `
260- * ` codecept g:page Acceptance Login `
261-
262-
263-
264- ## GenerateSuite
265-
266- Create new test suite. Requires suite name and actor name
267-
268- * ``
269- * ` codecept g:suite Api ` -> api + ApiTester
270- * ` codecept g:suite Integration Code ` -> integration + CodeTester
271- * ` codecept g:suite Frontend Front ` -> frontend + FrontTester
272-
273-
274-
275-
276- ## GenerateHelper
277-
278- Creates empty Helper class.
279-
280- * ` codecept g:helper MyHelper `
281- * ` codecept g:helper "My\Helper" `
282-
283-
284-
285- ## GenerateScenarios
286-
287- Generates user-friendly text scenarios from scenario-driven tests (Cest).
288-
289- * ` codecept g:scenarios Acceptance ` - for all acceptance tests
290- * ` codecept g:scenarios Acceptance --format html ` - in html format
291- * ` codecept g:scenarios Acceptance --path doc ` - generate scenarios to ` doc ` dir
292-
293-
294-
295- ## Init
296-
297-
298-
299314## GenerateEnvironment
300315
301316Generates empty environment configuration file into envs dir:
@@ -306,14 +321,7 @@ Required to have `envs` path to be specified in `codeception.yml`
306321
307322
308323
309- ## Build
310-
311- Generates Actor classes (initially Guy classes) from suite configs.
312- Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually.
313-
314- * ` codecept build `
315- * ` codecept build path/to/project `
316-
324+ ## Init
317325
318326
319327
@@ -328,11 +336,3 @@ codecept gherkin:steps Acceptance
328336
329337
330338
331- ## Console
332-
333- Try to execute test commands in run-time. You may try commands before writing the test.
334-
335- * ` codecept console Acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
336-
337-
338-
0 commit comments