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 Oct 9, 2024
1 parent 611943c commit 7777550
Showing 1 changed file with 111 additions and 111 deletions.
222 changes: 111 additions & 111 deletions docs/reference/Commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,32 @@ 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"`

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

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

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.


## Init

## GenerateSnapshot

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

Recursively cleans `output` directory and generated code.

* `codecept clean`

## Init



Expand All @@ -51,48 +44,69 @@ Auto-updates phar archive from official site: 'https://codeception.com/codecept.



## GenerateEnvironment
## GeneratePageObject

Generates empty environment configuration file into envs dir:
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:env firefox`
* `codecept g:page Login`
* `codecept g:page Registration`
* `codecept g:page acceptance Login`

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


## GherkinSteps

## Bootstrap
Prints all steps from all Gherkin contexts for a specific suite

Creates default config, tests directory and sample suites for current project.
Use this command to start building a test suite.
{% highlight yaml %}
codecept gherkin:steps acceptance

By default it will create 3 suites **Acceptance**, **Functional**, and **Unit**.
{% endhighlight %}

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



## Build

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

Generates Feature file (in Gherkin):
* `codecept build`
* `codecept build path/to/project`

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



## GenerateCest

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

Recursively cleans `output` directory and generated code.

* `codecept clean`


## GenerateHelper

Creates empty Helper class.

* `codecept g:helper MyHelper`
* `codecept g:helper "My\Helper"`




## GenerateEnvironment

Generates empty environment configuration file into envs dir:

* `codecept g:env firefox`

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



Expand All @@ -109,25 +123,21 @@ Create new test suite. Requires suite name and actor name



## Console

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

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.


## GenerateStepObject

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

* `codecept g:stepobject acceptance AdminSteps`
* `codecept g:stepobject acceptance UserSteps --silent` - skip action questions
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



Expand All @@ -139,63 +149,65 @@ Creates empty GroupObject - extension which handles all group events.



## GenerateTest

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

* `codecept g:test unit User`
* `codecept g:test unit "App\User"`
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

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

## GherkinSteps

Prints all steps from all Gherkin contexts for a specific suite

{% highlight yaml %}
codecept gherkin:steps acceptance

{% endhighlight %}
## 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

## GeneratePageObject
Load config:

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 config:validate -c path/to/another/config`: from another dir
* `codecept config:validate -c another_config.yml`: from another config file

* `codecept g:page Login`
* `codecept g:page Registration`
* `codecept g:page acceptance Login`
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


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

## GenerateSnapshot

Generates Snapshot.
Snapshot can be used to test dynamical data.
If suite name is provided, an actor class will be included into placeholder

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



Expand Down Expand Up @@ -287,49 +299,37 @@ Options:



## GenerateHelper

Creates empty Helper class.

* `codecept g:helper MyHelper`
* `codecept g:helper "My\Helper"`
## GenerateTest

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

* `codecept g:test unit User`
* `codecept g:test unit "App\User"`


## ConfigValidate

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

Check config:
Generates StepObject class. You will be asked for steps you want to implement.

* `codecept config`: check global config
* `codecept config unit`: check suite config
* `codecept g:stepobject acceptance AdminSteps`
* `codecept g:stepobject acceptance UserSteps --silent` - skip action questions

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


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



0 comments on commit 7777550

Please sign in to comment.