-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
github-actions[bot]
authored and
github-actions[bot]
committed
Jul 10, 2024
1 parent
723cb56
commit d570ad5
Showing
1 changed file
with
110 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,22 +5,65 @@ title: Commands - Codeception - Documentation | |
|
||
# Console Commands | ||
|
||
## SelfUpdate | ||
## Build | ||
|
||
Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar' . | ||
Generates Actor classes (initially Guy classes) from suite configs. | ||
Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually. | ||
|
||
* `php codecept.phar self-update` | ||
* `codecept build` | ||
* `codecept build path/to/project` | ||
|
||
@author Franck Cassedanne <[email protected]> | ||
|
||
|
||
|
||
## Bootstrap | ||
|
||
## GenerateGroup | ||
Creates default config, tests directory and sample suites for current project. | ||
Use this command to start building a test suite. | ||
|
||
Creates empty GroupObject - extension which handles all group events. | ||
By default it will create 3 suites **Acceptance**, **Functional**, and **Unit**. | ||
|
||
* `codecept g:group Admin` | ||
* `codecept bootstrap` - creates `tests` dir and `codeception.yml` in current dir. | ||
* `codecept bootstrap --empty` - creates `tests` dir without suites | ||
* `codecept bootstrap --namespace Frontend` - creates tests, and use `Frontend` namespace for actor classes and helpers. | ||
* `codecept bootstrap --actor Wizard` - sets actor as Wizard, to have `TestWizard` actor in tests. | ||
* `codecept bootstrap path/to/the/project` - provide different path to a project, where tests should be placed | ||
|
||
|
||
|
||
|
||
## GherkinSnippets | ||
|
||
Generates code snippets for matched feature files in a suite. | ||
Code snippets are expected to be implemented in Actor or PageObjects | ||
|
||
Usage: | ||
|
||
* `codecept gherkin:snippets acceptance` - snippets from all feature of acceptance tests | ||
* `codecept gherkin:snippets acceptance/feature/users` - snippets from `feature/users` dir of acceptance tests | ||
* `codecept gherkin:snippets acceptance user_account.feature` - snippets from a single feature file | ||
* `codecept gherkin:snippets acceptance/feature/users/user_accout.feature` - snippets from feature file in a dir | ||
|
||
|
||
|
||
## GenerateFeature | ||
|
||
Generates Feature file (in Gherkin): | ||
|
||
* `codecept generate:feature suite Login` | ||
* `codecept g:feature suite subdir/subdir/login.feature` | ||
* `codecept g:feature suite login.feature -c path/to/project` | ||
|
||
|
||
|
||
|
||
## GenerateScenarios | ||
|
||
Generates user-friendly text scenarios from scenario-driven tests (Cest). | ||
|
||
* `codecept g:scenarios acceptance` - for all acceptance tests | ||
* `codecept g:scenarios acceptance --format html` - in html format | ||
* `codecept g:scenarios acceptance --path doc` - generate scenarios to `doc` dir | ||
|
||
|
||
|
||
|
@@ -48,58 +91,70 @@ Check overriding config values (like in `run` command) | |
|
||
|
||
|
||
## CompletionFallback | ||
## GenerateTest | ||
|
||
Generates skeleton for Unit Test that extends `Codeception\TestCase\Test`. | ||
|
||
* `codecept g:test unit User` | ||
* `codecept g:test unit "App\User"` | ||
|
||
## Console | ||
|
||
Try to execute test commands in run-time. You may try commands before writing the test. | ||
|
||
* `codecept console acceptance` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands. | ||
## GenerateSuite | ||
|
||
Create new test suite. Requires suite name and actor name | ||
|
||
* `` | ||
* `codecept g:suite api` -> api + ApiTester | ||
* `codecept g:suite integration Code` -> integration + CodeTester | ||
* `codecept g:suite frontend Front` -> frontend + FrontTester | ||
|
||
## Build | ||
|
||
Generates Actor classes (initially Guy classes) from suite configs. | ||
Starting from Codeception 2.0 actor classes are auto-generated. Use this command to generate them manually. | ||
|
||
* `codecept build` | ||
* `codecept build path/to/project` | ||
|
||
## GenerateStepObject | ||
|
||
Generates StepObject class. You will be asked for steps you want to implement. | ||
|
||
* `codecept g:stepobject acceptance AdminSteps` | ||
* `codecept g:stepobject acceptance UserSteps --silent` - skip action questions | ||
|
||
## GherkinSteps | ||
|
||
Prints all steps from all Gherkin contexts for a specific suite | ||
|
||
{% highlight yaml %} | ||
codecept gherkin:steps acceptance | ||
|
||
{% endhighlight %} | ||
## GeneratePageObject | ||
|
||
Generates PageObject. Can be generated either globally, or just for one suite. | ||
If PageObject is generated globally it will act as UIMap, without any logic in it. | ||
|
||
* `codecept g:page Login` | ||
* `codecept g:page Registration` | ||
* `codecept g:page acceptance Login` | ||
|
||
|
||
## GenerateFeature | ||
|
||
Generates Feature file (in Gherkin): | ||
## Console | ||
|
||
* `codecept generate:feature suite Login` | ||
* `codecept g:feature suite subdir/subdir/login.feature` | ||
* `codecept g:feature suite login.feature -c path/to/project` | ||
Try to execute test commands in run-time. You may try commands before writing the test. | ||
|
||
* `codecept console acceptance` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands. | ||
|
||
|
||
|
||
## GenerateTest | ||
## CompletionFallback | ||
|
||
|
||
|
||
## DryRun | ||
|
||
Shows step by step execution process for scenario driven tests without actually running them. | ||
|
||
* `codecept dry-run acceptance` | ||
* `codecept dry-run acceptance MyCest` | ||
* `codecept dry-run acceptance checkout.feature` | ||
* `codecept dry-run tests/acceptance/MyCest.php` | ||
|
||
Generates skeleton for Unit Test that extends `Codeception\TestCase\Test`. | ||
|
||
* `codecept g:test unit User` | ||
* `codecept g:test unit "App\User"` | ||
|
||
|
||
|
||
|
@@ -191,85 +246,43 @@ Options: | |
|
||
|
||
|
||
## GeneratePageObject | ||
|
||
Generates PageObject. Can be generated either globally, or just for one suite. | ||
If PageObject is generated globally it will act as UIMap, without any logic in it. | ||
|
||
* `codecept g:page Login` | ||
* `codecept g:page Registration` | ||
* `codecept g:page acceptance Login` | ||
|
||
|
||
|
||
## Clean | ||
|
||
Recursively cleans `output` directory and generated code. | ||
|
||
* `codecept clean` | ||
|
||
|
||
|
||
|
||
## GenerateStepObject | ||
|
||
Generates StepObject class. You will be asked for steps you want to implement. | ||
|
||
* `codecept g:stepobject acceptance AdminSteps` | ||
* `codecept g:stepobject acceptance UserSteps --silent` - skip action questions | ||
|
||
|
||
|
||
|
||
## GherkinSnippets | ||
## GherkinSteps | ||
|
||
Generates code snippets for matched feature files in a suite. | ||
Code snippets are expected to be implemented in Actor or PageObjects | ||
Prints all steps from all Gherkin contexts for a specific suite | ||
|
||
Usage: | ||
{% highlight yaml %} | ||
codecept gherkin:steps acceptance | ||
|
||
* `codecept gherkin:snippets acceptance` - snippets from all feature of acceptance tests | ||
* `codecept gherkin:snippets acceptance/feature/users` - snippets from `feature/users` dir of acceptance tests | ||
* `codecept gherkin:snippets acceptance user_account.feature` - snippets from a single feature file | ||
* `codecept gherkin:snippets acceptance/feature/users/user_accout.feature` - snippets from feature file in a dir | ||
{% endhighlight %} | ||
|
||
|
||
|
||
## GenerateCest | ||
|
||
Generates Cest (scenario-driven object-oriented test) file: | ||
## GenerateEnvironment | ||
|
||
* `codecept generate:cest suite Login` | ||
* `codecept g:cest suite subdir/subdir/testnameCest.php` | ||
* `codecept g:cest suite LoginCest -c path/to/project` | ||
* `codecept g:cest "App\Login"` | ||
Generates empty environment configuration file into envs dir: | ||
|
||
* `codecept g:env firefox` | ||
|
||
Required to have `envs` path to be specified in `codeception.yml` | ||
|
||
|
||
## Bootstrap | ||
|
||
Creates default config, tests directory and sample suites for current project. | ||
Use this command to start building a test suite. | ||
## GenerateGroup | ||
|
||
By default it will create 3 suites **Acceptance**, **Functional**, and **Unit**. | ||
Creates empty GroupObject - extension which handles all group events. | ||
|
||
* `codecept bootstrap` - creates `tests` dir and `codeception.yml` in current dir. | ||
* `codecept bootstrap --empty` - creates `tests` dir without suites | ||
* `codecept bootstrap --namespace Frontend` - creates tests, and use `Frontend` namespace for actor classes and helpers. | ||
* `codecept bootstrap --actor Wizard` - sets actor as Wizard, to have `TestWizard` actor in tests. | ||
* `codecept bootstrap path/to/the/project` - provide different path to a project, where tests should be placed | ||
* `codecept g:group Admin` | ||
|
||
|
||
|
||
## SelfUpdate | ||
|
||
## GenerateScenarios | ||
Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar' . | ||
|
||
Generates user-friendly text scenarios from scenario-driven tests (Cest). | ||
* `php codecept.phar self-update` | ||
|
||
* `codecept g:scenarios acceptance` - for all acceptance tests | ||
* `codecept g:scenarios acceptance --format html` - in html format | ||
* `codecept g:scenarios acceptance --path doc` - generate scenarios to `doc` dir | ||
@author Franck Cassedanne <[email protected]> | ||
|
||
|
||
|
||
|
@@ -283,29 +296,16 @@ Creates empty Helper class. | |
|
||
|
||
|
||
## GenerateSuite | ||
|
||
Create new test suite. Requires suite name and actor name | ||
|
||
* `` | ||
* `codecept g:suite api` -> api + ApiTester | ||
* `codecept g:suite integration Code` -> integration + CodeTester | ||
* `codecept g:suite frontend Front` -> frontend + FrontTester | ||
|
||
|
||
|
||
|
||
## Init | ||
|
||
|
||
|
||
## GenerateEnvironment | ||
## Clean | ||
|
||
Generates empty environment configuration file into envs dir: | ||
Recursively cleans `output` directory and generated code. | ||
|
||
* `codecept g:env firefox` | ||
* `codecept clean` | ||
|
||
Required to have `envs` path to be specified in `codeception.yml` | ||
|
||
|
||
|
||
|
@@ -321,14 +321,14 @@ If suite name is provided, an actor class will be included into placeholder | |
|
||
|
||
|
||
## DryRun | ||
## GenerateCest | ||
|
||
Shows step by step execution process for scenario driven tests without actually running them. | ||
Generates Cest (scenario-driven object-oriented test) file: | ||
|
||
* `codecept dry-run acceptance` | ||
* `codecept dry-run acceptance MyCest` | ||
* `codecept dry-run acceptance checkout.feature` | ||
* `codecept dry-run tests/acceptance/MyCest.php` | ||
* `codecept generate:cest suite Login` | ||
* `codecept g:cest suite subdir/subdir/testnameCest.php` | ||
* `codecept g:cest suite LoginCest -c path/to/project` | ||
* `codecept g:cest "App\Login"` | ||
|
||
|
||
|
||
|