Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored and github-actions[bot] committed Aug 1, 2024
1 parent ced5d61 commit effe93f
Showing 1 changed file with 125 additions and 125 deletions.
250 changes: 125 additions & 125 deletions docs/reference/Commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,89 +5,57 @@ title: Commands - Codeception - Documentation

# Console Commands

## GenerateCest

Generates Cest (scenario-driven object-oriented test) file:

* `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"`




## Clean

Recursively cleans `output` directory and generated code.

* `codecept clean`




## 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.



## GenerateGroup
## SelfUpdate

Creates empty GroupObject - extension which handles all group events.
Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar' .

* `codecept g:group Admin`
* `php codecept.phar self-update`

@author Franck Cassedanne <[email protected]>


## 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.
## Init

* `codecept build`
* `codecept build path/to/project`


## GherkinSnippets

Generates code snippets for matched feature files in a suite.
Code snippets are expected to be implemented in Actor or PageObjects

## GenerateSuite
Usage:

Create new test suite. Requires suite name and actor name
* `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

* ``
* `codecept g:suite api` -> api + ApiTester
* `codecept g:suite integration Code` -> integration + CodeTester
* `codecept g:suite frontend Front` -> frontend + FrontTester


## GenerateEnvironment

Generates empty environment configuration file into envs dir:

## GenerateSnapshot
* `codecept g:env firefox`

Generates Snapshot.
Snapshot can be used to test dynamical data.
If suite name is provided, an actor class will be included into placeholder
Required to have `envs` path to be specified in `codeception.yml`

* `codecept g:snapshot UserEmails`
* `codecept g:snapshot Products`
* `codecept g:snapshot acceptance UserEmails`


## CompletionFallback

## 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
## 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`

## CompletionFallback



Expand All @@ -101,83 +69,76 @@ Creates empty Helper class.



## GenerateTest
## GenerateSuite

Generates skeleton for Unit Test that extends `Codeception\TestCase\Test`.
Create new test suite. Requires suite name and actor name

* `codecept g:test unit User`
* `codecept g:test unit "App\User"`
* ``
* `codecept g:suite api` -> api + ApiTester
* `codecept g:suite integration Code` -> integration + CodeTester
* `codecept g:suite frontend Front` -> frontend + FrontTester



## GenerateFeature

Generates Feature file (in Gherkin):
## Build

* `codecept generate:feature suite Login`
* `codecept g:feature suite subdir/subdir/login.feature`
* `codecept g:feature suite login.feature -c path/to/project`
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`



## 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.
## GenerateSnapshot

* `codecept g:page Login`
* `codecept g:page Registration`
* `codecept g:page acceptance Login`
Generates Snapshot.
Snapshot can be used to test dynamical data.
If suite name is provided, an actor class will be included into placeholder

* `codecept g:snapshot UserEmails`
* `codecept g:snapshot Products`
* `codecept g:snapshot acceptance UserEmails`


## Bootstrap

Creates default config, tests directory and sample suites for current project.
Use this command to start building a test suite.
## Clean

By default it will create 3 suites **Acceptance**, **Functional**, and **Unit**.
Recursively cleans `output` directory and generated code.

* `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 clean`




## GenerateEnvironment
## Console

Generates empty environment configuration file into envs dir:
Try to execute test commands in run-time. You may try commands before writing the test.

* `codecept g:env firefox`
* `codecept console acceptance` - starts acceptance suite environment. If you use WebDriver you can manipulate browser with Codeception commands.

Required to have `envs` path to be specified in `codeception.yml`


## GenerateStepObject

## ConfigValidate
Generates StepObject class. You will be asked for steps you want to implement.

Validates and prints Codeception config.
Use it do debug Yaml configs
* `codecept g:stepobject acceptance AdminSteps`
* `codecept g:stepobject acceptance UserSteps --silent` - skip action questions

Check config:

* `codecept config`: check global config
* `codecept config unit`: check suite config

Load config:

* `codecept config:validate -c path/to/another/config`: from another dir
* `codecept config:validate -c another_config.yml`: from another config file
## GherkinSteps

Check overriding config values (like in `run` command)
Prints all steps from all Gherkin contexts for a specific suite

* `codecept config:validate -o "settings: shuffle: true"`: enable shuffle
* `codecept config:validate -o "settings: lint: false"`: disable linting
* `codecept config:validate -o "reporters: report: \Custom\Reporter" --report`: use custom reporter
{% highlight yaml %}
codecept gherkin:steps acceptance

{% endhighlight %}



Expand Down Expand Up @@ -270,65 +231,104 @@ Options:



## GeneratePageObject

## GherkinSnippets
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.

Generates code snippets for matched feature files in a suite.
Code snippets are expected to be implemented in Actor or PageObjects
* `codecept g:page Login`
* `codecept g:page Registration`
* `codecept g:page acceptance Login`

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):

## SelfUpdate
* `codecept generate:feature suite Login`
* `codecept g:feature suite subdir/subdir/login.feature`
* `codecept g:feature suite login.feature -c path/to/project`

Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar' .

* `php codecept.phar self-update`

@author Franck Cassedanne <[email protected]>

## GenerateGroup

Creates empty GroupObject - extension which handles all group events.

## Init
* `codecept g:group Admin`



## GherkinSteps
## GenerateScenarios

Prints all steps from all Gherkin contexts for a specific suite
Generates user-friendly text scenarios from scenario-driven tests (Cest).

{% highlight yaml %}
codecept gherkin:steps acceptance
* `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

{% endhighlight %}



## GenerateTest

## GenerateStepObject
Generates skeleton for Unit Test that extends `Codeception\TestCase\Test`.

Generates StepObject class. You will be asked for steps you want to implement.
* `codecept g:test unit User`
* `codecept g:test unit "App\User"`

* `codecept g:stepobject acceptance AdminSteps`
* `codecept g:stepobject acceptance UserSteps --silent` - skip action questions


## GenerateCest

Generates Cest (scenario-driven object-oriented test) file:

## DryRun
* `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"`

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`


## Bootstrap

Creates default config, tests directory and sample suites for current project.
Use this command to start building a test suite.

By default it will create 3 suites **Acceptance**, **Functional**, and **Unit**.

* `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




## ConfigValidate

Validates and prints Codeception config.
Use it do debug Yaml configs

Check config:

* `codecept config`: check global config
* `codecept config unit`: check suite config

Load config:

* `codecept config:validate -c path/to/another/config`: from another dir
* `codecept config:validate -c another_config.yml`: from another config file

Check overriding config values (like in `run` command)

* `codecept config:validate -o "settings: shuffle: true"`: enable shuffle
* `codecept config:validate -o "settings: lint: false"`: disable linting
* `codecept config:validate -o "reporters: report: \Custom\Reporter" --report`: use custom reporter



Expand Down

0 comments on commit effe93f

Please sign in to comment.