@@ -5,111 +5,19 @@ title: Commands - Codeception - Documentation
55
66# Console Commands
77
8- ## GenerateCest
9-
10- Generates Cest (scenario-driven object-oriented test) file:
11-
12- * ` codecept generate:cest suite Login `
13- * ` codecept g:cest suite subdir/subdir/testnameCest.php `
14- * ` codecept g:cest suite LoginCest -c path/to/project `
15- * ` codecept g:cest "App\Login" `
16-
17-
18-
19-
20- ## Console
21-
22- Try to execute test commands in run-time. You may try commands before writing the test.
23-
24- * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
25-
26-
27-
28- ## GenerateSnapshot
8+ ## GenerateTest
299
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
10+ Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
3311
34- * ` codecept g:snapshot UserEmails `
35- * ` codecept g:snapshot Products `
36- * ` codecept g:snapshot acceptance UserEmails `
12+ * ` codecept g:test unit User `
13+ * ` codecept g:test unit "App\User" `
3714
3815
3916
4017## Init
4118
4219
4320
44- ## SelfUpdate
45-
46- Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar ' .
47-
48- * ` php codecept.phar self-update `
49-
50- @author Franck Cassedanne < franck@cassedanne.com >
51-
52-
53-
54- ## GenerateEnvironment
55-
56- Generates empty environment configuration file into envs dir:
57-
58- * ` codecept g:env firefox `
59-
60- Required to have ` envs ` path to be specified in ` codeception.yml `
61-
62-
63-
64- ## Bootstrap
65-
66- Creates default config, tests directory and sample suites for current project.
67- Use this command to start building a test suite.
68-
69- By default it will create 3 suites ** Acceptance** , ** Functional** , and ** Unit** .
70-
71- * ` codecept bootstrap ` - creates ` tests ` dir and ` codeception.yml ` in current dir.
72- * ` codecept bootstrap --empty ` - creates ` tests ` dir without suites
73- * ` codecept bootstrap --namespace Frontend ` - creates tests, and use ` Frontend ` namespace for actor classes and helpers.
74- * ` codecept bootstrap --actor Wizard ` - sets actor as Wizard, to have ` TestWizard ` actor in tests.
75- * ` codecept bootstrap path/to/the/project ` - provide different path to a project, where tests should be placed
76-
77-
78-
79-
80- ## GenerateFeature
81-
82- Generates Feature file (in Gherkin):
83-
84- * ` codecept generate:feature suite Login `
85- * ` codecept g:feature suite subdir/subdir/login.feature `
86- * ` codecept g:feature suite login.feature -c path/to/project `
87-
88-
89-
90-
91- ## Clean
92-
93- Recursively cleans ` output ` directory and generated code.
94-
95- * ` codecept clean `
96-
97-
98-
99-
100- ## GenerateSuite
101-
102- Create new test suite. Requires suite name and actor name
103-
104- * ``
105- * ` codecept g:suite api ` -> api + ApiTester
106- * ` codecept g:suite integration Code ` -> integration + CodeTester
107- * ` codecept g:suite frontend Front ` -> frontend + FrontTester
108-
109-
110-
111-
112-
11321## Build
11422
11523Generates Actor classes (initially Guy classes) from suite configs.
@@ -121,30 +29,27 @@ Starting from Codeception 2.0 actor classes are auto-generated. Use this command
12129
12230
12331
124- ## GenerateStepObject
125-
126- Generates StepObject class. You will be asked for steps you want to implement.
127-
128- * ` codecept g:stepobject acceptance AdminSteps `
129- * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
130-
131-
32+ ## SelfUpdate
13233
34+ Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar ' .
13335
134- ## GenerateGroup
36+ * ` php codecept.phar self-update `
13537
136- Creates empty GroupObject - extension which handles all group events.
38+ @ author Franck Cassedanne < franck@cassedanne.com >
13739
138- * ` codecept g:group Admin `
13940
14041
42+ ## GherkinSnippets
14143
142- ## GenerateTest
44+ Generates code snippets for matched feature files in a suite.
45+ Code snippets are expected to be implemented in Actor or PageObjects
14346
144- Generates skeleton for Unit Test that extends ` Codeception\TestCase\Test ` .
47+ Usage:
14548
146- * ` codecept g:test unit User `
147- * ` codecept g:test unit "App\User" `
49+ * ` codecept gherkin:snippets acceptance ` - snippets from all feature of acceptance tests
50+ * ` codecept gherkin:snippets acceptance/feature/users ` - snippets from ` feature/users ` dir of acceptance tests
51+ * ` codecept gherkin:snippets acceptance user_account.feature ` - snippets from a single feature file
52+ * ` codecept gherkin:snippets acceptance/feature/users/user_accout.feature ` - snippets from feature file in a dir
14853
14954
15055
@@ -158,17 +63,29 @@ Generates user-friendly text scenarios from scenario-driven tests (Cest).
15863
15964
16065
161- ## GherkinSteps
66+ ## GenerateCest
16267
163- Prints all steps from all Gherkin contexts for a specific suite
68+ Generates Cest (scenario-driven object-oriented test) file:
16469
165- {% highlight yaml %}
166- codecept gherkin: steps acceptance
70+ * ` codecept generate:cest suite Login `
71+ * ` codecept g:cest suite subdir/subdir/testnameCest.php `
72+ * ` codecept g:cest suite LoginCest -c path/to/project `
73+ * ` codecept g:cest "App\Login" `
16774
168- {% endhighlight %}
16975
17076
17177
78+ ## GenerateSnapshot
79+
80+ Generates Snapshot.
81+ Snapshot can be used to test dynamical data.
82+ If suite name is provided, an actor class will be included into placeholder
83+
84+ * ` codecept g:snapshot UserEmails `
85+ * ` codecept g:snapshot Products `
86+ * ` codecept g:snapshot acceptance UserEmails `
87+
88+
17289
17390## GeneratePageObject
17491
@@ -181,21 +98,27 @@ If PageObject is generated globally it will act as UIMap, without any logic in i
18198
18299
183100
184- ## GherkinSnippets
101+ ## GherkinSteps
185102
186- Generates code snippets for matched feature files in a suite.
187- Code snippets are expected to be implemented in Actor or PageObjects
103+ Prints all steps from all Gherkin contexts for a specific suite
188104
189- Usage:
105+ {% highlight yaml %}
106+ codecept gherkin: steps acceptance
190107
191- * ` codecept gherkin:snippets acceptance ` - snippets from all feature of acceptance tests
192- * ` codecept gherkin:snippets acceptance/feature/users ` - snippets from ` feature/users ` dir of acceptance tests
193- * ` codecept gherkin:snippets acceptance user_account.feature ` - snippets from a single feature file
194- * ` codecept gherkin:snippets acceptance/feature/users/user_accout.feature ` - snippets from feature file in a dir
108+ {% endhighlight %}
195109
196110
197111
198- ## CompletionFallback
112+
113+ ## GenerateSuite
114+
115+ Create new test suite. Requires suite name and actor name
116+
117+ * ``
118+ * ` codecept g:suite api ` -> api + ApiTester
119+ * ` codecept g:suite integration Code ` -> integration + CodeTester
120+ * ` codecept g:suite frontend Front ` -> frontend + FrontTester
121+
199122
200123
201124
@@ -287,13 +210,36 @@ Options:
287210
288211
289212
290- ## GenerateHelper
213+ ## Bootstrap
214+
215+ Creates default config, tests directory and sample suites for current project.
216+ Use this command to start building a test suite.
217+
218+ By default it will create 3 suites ** Acceptance** , ** Functional** , and ** Unit** .
219+
220+ * ` codecept bootstrap ` - creates ` tests ` dir and ` codeception.yml ` in current dir.
221+ * ` codecept bootstrap --empty ` - creates ` tests ` dir without suites
222+ * ` codecept bootstrap --namespace Frontend ` - creates tests, and use ` Frontend ` namespace for actor classes and helpers.
223+ * ` codecept bootstrap --actor Wizard ` - sets actor as Wizard, to have ` TestWizard ` actor in tests.
224+ * ` codecept bootstrap path/to/the/project ` - provide different path to a project, where tests should be placed
225+
291226
292- Creates empty Helper class.
293227
294- * ` codecept g:helper MyHelper `
295- * ` codecept g:helper "My\Helper" `
296228
229+ ## Clean
230+
231+ Recursively cleans ` output ` directory and generated code.
232+
233+ * ` codecept clean `
234+
235+
236+
237+
238+ ## GenerateGroup
239+
240+ Creates empty GroupObject - extension which handles all group events.
241+
242+ * ` codecept g:group Admin `
297243
298244
299245
@@ -321,6 +267,35 @@ Check overriding config values (like in `run` command)
321267
322268
323269
270+ ## Console
271+
272+ Try to execute test commands in run-time. You may try commands before writing the test.
273+
274+ * ` codecept console acceptance ` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.
275+
276+
277+
278+
279+ ## GenerateHelper
280+
281+ Creates empty Helper class.
282+
283+ * ` codecept g:helper MyHelper `
284+ * ` codecept g:helper "My\Helper" `
285+
286+
287+
288+
289+ ## GenerateEnvironment
290+
291+ Generates empty environment configuration file into envs dir:
292+
293+ * ` codecept g:env firefox `
294+
295+ Required to have ` envs ` path to be specified in ` codeception.yml `
296+
297+
298+
324299## DryRun
325300
326301Shows step by step execution process for scenario driven tests without actually running them.
@@ -333,3 +308,28 @@ Shows step by step execution process for scenario driven tests without actually
333308
334309
335310
311+ ## CompletionFallback
312+
313+
314+
315+ ## GenerateFeature
316+
317+ Generates Feature file (in Gherkin):
318+
319+ * ` codecept generate:feature suite Login `
320+ * ` codecept g:feature suite subdir/subdir/login.feature `
321+ * ` codecept g:feature suite login.feature -c path/to/project `
322+
323+
324+
325+
326+ ## GenerateStepObject
327+
328+ Generates StepObject class. You will be asked for steps you want to implement.
329+
330+ * ` codecept g:stepobject acceptance AdminSteps `
331+ * ` codecept g:stepobject acceptance UserSteps --silent ` - skip action questions
332+
333+
334+
335+
0 commit comments