Skip to content

Latest commit

 

History

History
189 lines (121 loc) · 8.33 KB

Configuration.md

File metadata and controls

189 lines (121 loc) · 8.33 KB
layout title
doc
Configuration - Codeception - Documentation

Configuration

Global Configuration: codeception.yml

The global configuration file codeception.yml is generated by the codecept bootstrap command. Alphabetical list of options:

actor_suffix

Sets the suffix for "Actor" classes. Default: Tester. If you set it to Ninja and generate a new api test suite, you will get an ApiNinja actor class.

bootstrap

Bootstrap script that will be executed before all suites. A script should be put into tests directory.

coverage

CodeCoverage settings.

extends

Allows you to specify a file (relative to the codeception.yml file) that holds some already pre-defined values. This can be used to always use the same configuration for modules or whatever.

extensions

Allows to enable and configure Codeception extensions, Group Objects, and Custom Commands.

gherkin

Gherkin options.

include

Include additional Codeception configurations for multiple applications setup.

modules

Allows to create shared module configuration for all included suites.

{% highlight yaml %} modules: config: Db: dsn: '' user: '' password: '' dump: tests/_data/dump.sql {% endhighlight %}

namespace

Sets the namespace under which all new tests and support classes will be generated. Allows to configure multiple test setups for one runner.

params

Allows to pass external parameters into module configuration.

paths

Directories used by Codeception. Default values:

{% highlight yaml %} paths: tests : tests # where the tests stored data : tests/_data # directory for fixture data support: tests/_support # directory for support code output : tests/_output # directory for output envs : tests/_envs # directory for environment configuration {% endhighlight %}

reporters

Allows to change default reporters of Codeception

settings

Provide additional options for the test runner. They may dramatically change the way Codeception is executed. For instance, take a note of shuffle option which allows to randomize tests execution order and lint option that toggles parsing a test file (using php -l) before loading it.

Syntax example: {% highlight yaml %} settings: colors: true {% endhighlight %}

Possible settings:

Suite Configuration: unit.suite.yml, functional.suite.yml etc.

Each suite has its own configuration inside the directory set by paths: tests: in codeception.yml. Alphabetical list of options:

actor

Name of the "Actor" class of the current suite.

bootstrap

Bootstrap script that will be executed before current suite. A script should be put into suite directory.

coverage

Per suite CodeCoverage settings.

env

Override any configuration per environment.

error_level

error level for runner in the current suite. Can be specified for unit, integration, functional tests. Passes value to error_reporting function.

extends

Allows you to specify a file (relative to *.suite.yml) that holds some already pre-defined values. This can be used to always use the same configuration for modules or whatever.

gherkin

Per suite Gherkin settings.

groups

groups with the list of tests of for corresponding group.

formats

formats with the list of extra test format classes.

modules

List of enabled modules with their configuration.

{% highlight yaml %} modules: enabled: - PhpBrowser: # built-in modules are listed by their names url: http://localhost # module configuration - Db # Module without configuration (or inherited from codeception.yml) - \Helper\Acceptance # helper names are listed by their class names, starting with \

# Additional modules configuration; can be used for modules which are not currently enabled
config:
    WebDriver:
        browser: firefox

disabled:
    - WebDriver # modules disabled for this suite

{% endhighlight %}

namespace

Default namespace of actor, support classes and tests.

suite_namespace

Default namespace for new tests of this suite (ignores namespace option)

Configuration Templates: *.dist.yml

To provide the same configuration template for your development team, you can create a codeception.dist.yml config file, which will be loaded before codeception.yml. The dist config provides shared options, while local codeception.yml files override them on a per-installation basis. Therefore, codeception.yml should be ignored by your VCS system.

Config templates can also be used for suite configuration, by creating a suitename.suite.dist.yml file.

Configuration loading order:

  1. codeception.dist.yml
  2. codeception.yml
  3. acceptance.suite.dist.yml
  4. acceptance.suite.yml
  5. environment config