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 Apr 6, 2024
1 parent 34f620b commit 6c4b2cb
Showing 1 changed file with 108 additions and 108 deletions.
216 changes: 108 additions & 108 deletions docs/reference/Commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,38 @@ title: Commands - Codeception - Documentation

# Console Commands

## DryRun
## GenerateSuite

Shows step by step execution process for scenario driven tests without actually running them.
Create new test suite. Requires suite name and actor name

* `codecept dry-run acceptance`
* `codecept dry-run acceptance MyCest`
* `codecept dry-run acceptance checkout.feature`
* `codecept dry-run tests/acceptance/MyCest.php`
* ``
* `codecept g:suite api` -> api + ApiTester
* `codecept g:suite integration Code` -> integration + CodeTester
* `codecept g:suite frontend Front` -> frontend + FrontTester




## GenerateCest
## CompletionFallback

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

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

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




Expand All @@ -61,54 +60,50 @@ Generates user-friendly text scenarios from scenario-driven tests (Cest).



## GenerateEnvironment

Generates empty environment configuration file into envs dir:

* `codecept g:env firefox`
## Bootstrap

Required to have `envs` path to be specified in `codeception.yml`
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

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

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


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

Creates empty GroupObject - extension which handles all group events.

* `codecept g:group Admin`

## Clean

Recursively cleans `output` directory and generated code.

* `codecept clean`
## Init



Expand All @@ -124,42 +119,27 @@ If PageObject is generated globally it will act as UIMap, without any logic in i



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




## SelfUpdate

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

* `php codecept.phar self-update`

@author Franck Cassedanne <franck@cassedanne.com>



## CompletionFallback

## GenerateSnapshot

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

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

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`

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

## Init



Expand Down Expand Up @@ -251,12 +231,52 @@ Options:



## GenerateTest
## GenerateCest

Generates skeleton for Unit Test that extends `Codeception\TestCase\Test`.
Generates Cest (scenario-driven object-oriented test) file:

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




## GherkinSteps

Prints all steps from all Gherkin contexts for a specific suite

{% highlight yaml %}
codecept gherkin:steps acceptance

{% endhighlight %}




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




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



Expand Down Expand Up @@ -284,52 +304,32 @@ Check overriding config values (like in `run` command)



## GherkinSteps

Prints all steps from all Gherkin contexts for a specific suite

{% highlight yaml %}
codecept gherkin:steps acceptance

{% endhighlight %}




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

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.

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

* `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
Auto-updates phar archive from official site: 'https://codeception.com/codecept.phar' .

* `php codecept.phar self-update`

@author Franck Cassedanne <franck@cassedanne.com>



## GenerateGroup
## GenerateTest

Creates empty GroupObject - extension which handles all group events.
Generates skeleton for Unit Test that extends `Codeception\TestCase\Test`.

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



0 comments on commit 6c4b2cb

Please sign in to comment.