You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Configuration file `codeception.yml` is generated by `codecept bootstrap` command. It has preconfigured settings you can change.
10
+
The global configuration file `codeception.yml` is generated by the `codecept bootstrap` command. Alphabetical list of options:
11
11
12
-
Here are global options you can change inside configuration:
12
+
### `actor_suffix`
13
13
14
-
*`actor_suffix: Tester`: changes suffix for Actor classes. This defines a rule to generate new test suites. If you change `Tester` to `Ninja`, and generate new `api` test suite, you will get `ApiNinja` actor class.
15
-
*`namespace`: set a namespace for tests. All new tests and support classes will be generated under that namespace. Allows to configure [multiple test setups for one runner](https://codeception.com/docs/08-Customization#Namespaces).
16
-
*`include: []`: include additional Codeception configurations for [multiple applications setup](https://codeception.com/docs/08-Customization#Namespaces).
17
-
*`paths` directories used by Codeception. Default values are:
14
+
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.
18
15
19
-
{% highlight yaml %}
16
+
### `bootstrap`
20
17
21
-
paths:
22
-
# where the tests stored
23
-
tests: tests
18
+
Bootstrap script that will be executed before all suites. A script should be put into `tests` directory.
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.
27
+
28
+
### `extensions`
24
29
25
-
# directory for fixture data
26
-
data: tests/_data
30
+
Allows to enable and configure [Codeception extensions](https://codeception.com/docs/08-Customization#Extension), [Group Objects](https://codeception.com/docs/08-Customization#Group-Objects), and [Custom Commands](https://codeception.com/docs/08-Customization#Custom-Commands).
Include additional Codeception configurations for [multiple applications setup](https://codeception.com/docs/08-Customization#Namespaces).
39
+
40
+
### `modules`
41
+
42
+
Allows to create shared module configuration for all included suites.
43
+
44
+
{% highlight yaml %}
45
+
modules:
46
+
config:
47
+
Db:
48
+
dsn: ''
49
+
user: ''
50
+
password: ''
51
+
dump: tests/_data/dump.sql
37
52
{% endhighlight %}
38
53
39
-
*`settings`: provide additional options for 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.
54
+
### `namespace`
55
+
56
+
Sets the namespace under which all new tests and support classes will be generated. Allows to configure [multiple test setups for one runner](https://codeception.com/docs/08-Customization#Namespaces).
57
+
58
+
### `params`
59
+
60
+
Allows to pass [external parameters](https://codeception.com/docs/06-ModulesAndHelpers#Dynamic-Configuration-With-Parameters) into module configuration.
61
+
62
+
### `paths`
63
+
64
+
Directories used by Codeception. Default values:
40
65
41
66
{% highlight yaml %}
67
+
paths:
68
+
tests : tests # where the tests stored
69
+
data : tests/_data # directory for fixture data
70
+
support: tests/_support # directory for support code
71
+
output : tests/_output # directory for output
72
+
envs : tests/_envs # directory for environment configuration
73
+
{% endhighlight %}
42
74
43
-
settings:
75
+
### `reporters`
76
+
77
+
Allows to [change default reporters](https://codeception.com/docs/08-Customization#Custom-Reporters) of Codeception
44
78
45
-
# enable/disable syntax of test files before loading
46
-
# for php < 7 exec('php -l') is used
47
-
# disable if you need to speed up tests execution
48
-
lint: true
79
+
### `settings`
49
80
50
-
# randomize test order
51
-
shuffle: true
81
+
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.
52
82
53
-
# by default it's false on Windows
54
-
# use [ANSICON](https://github.com/adoxa/ansicon) to colorize output.
83
+
Syntax example:
84
+
{% highlight yaml %}
85
+
settings:
55
86
colors: true
87
+
{% endhighlight %}
56
88
57
-
# Generate XML JUnit report using strict schema
58
-
# Avoid putting additional report fields like steps or scenario names to it
59
-
# Required for XML reports on Jenkins CI
60
-
strict_xml: false
89
+
Possible settings:
61
90
62
-
# Tests (especially functional) can take a lot of memory
63
-
# We set a high limit for them by default.
64
-
memory_limit: 1024M
91
+
*`backup_globals: true`: Controls whether PHPUnit attempts to backup global variables, see https://phpunit.de/manual/current/en/appendixes.annotations.html#appendixes.annotations.backupGlobals
92
+
*`be_strict_about_changes_to_global_state: false`: PHPUnit can be strict about tests that manipulate global state, see https://phpunit.de/manual/current/en/risky-tests.html#risky-tests.global-state-manipulation
93
+
*`colors: true`: By default this is false on Windows. Use [ANSICON](https://github.com/adoxa/ansicon) to colorize output.
94
+
*`disallow_test_output: false`: PHPUnit can be strict about output during tests, see https://phpunit.de/manual/current/en/risky-tests.html#risky-tests.output-during-test-execution
95
+
*`editor_url: 'atom://core/open/file?filename=%%file%%&line=%%line%%'`: In the console output, the test runner will replace all references to files with "clickable" URL's, allowing you to open the file directly in your IDE. Depending on your operating system, you may have to set up an appropriate uri handler. Syntax for some common editors (same as in [PHPStan](https://phpstan.org/user-guide/output-format#opening-file-in-an-editor)):
*`error_level: E_ALL & ~E_STRICT & ~E_DEPRECATED`: Set the error_reporting level. You can specify either a predefined constant or an integer value, see https://www.php.net/manual/en/function.error-reporting.php and https://www.php.net/manual/en/errorfunc.constants.php
100
+
*`memory_limit: 1024M`: Tests (especially functional) can take a lot of memory. We set a high limit for them by default.
101
+
*`lint: true`: Enable/disable syntax of test files before loading. For PHP < 7 `exec('php -l')` is used. Disable if you need to speed up tests execution.
102
+
*`log_incomplete_skipped: false`: Log the incomplete and skipped tests into junit report ,see https://phpunit.de/manual/current/en/appendixes.configuration.html Section logging > junit
103
+
*`report_useless_tests: false`: PHPUnit can be strict about tests that do not test anything, see https://phpunit.de/manual/current/en/risky-tests.html#risky-tests.useless-tests
104
+
*`shuffle: true`: Randomize test order
105
+
*`strict_xml: false`: Generate XML JUnit report using strict schema. Avoid putting additional report fields like steps or scenario names to it. Required for XML reports on Jenkins CI
65
106
66
-
# This value controls whether PHPUnit attempts to backup global variables
67
-
# See https://phpunit.de/manual/current/en/appendixes.annotations.html#appendixes.annotations.backupGlobals
68
-
backup_globals: true
107
+
## Suite Configuration: `unit.suite.yml`, `functional.suite.yml` etc.
69
108
70
-
# PHPUnit can be strict about tests that do not test anything
71
-
# See https://phpunit.de/manual/current/en/risky-tests.html#risky-tests.useless-tests
72
-
report_useless_tests: false
109
+
Each suite has its own configuration inside the directory set by `paths: tests: ` in `codeception.yml`. Alphabetical list of options:
73
110
74
-
# PHPUnit can be strict about output during tests.
75
-
# See https://phpunit.de/manual/current/en/risky-tests.html#risky-tests.output-during-test-execution
76
-
disallow_test_output: false
111
+
### `actor`
77
112
78
-
# PHPUnit can be strict about tests that manipulate global state.
79
-
# See https://phpunit.de/manual/current/en/risky-tests.html#risky-tests.global-state-manipulation
80
-
be_strict_about_changes_to_global_state: false
113
+
Name of the "Actor" class of the current suite.
81
114
82
-
# Log the incomplete and skipped tests into junit report
83
-
# See https://phpunit.de/manual/current/en/appendixes.configuration.html
84
-
# Section logging > junit
85
-
log_incomplete_skipped: false
115
+
### `bootstrap`
86
116
87
-
# Set the error_reporting level
88
-
# You can specify either a predefined constant or an integer value
89
-
# See https://www.php.net/manual/en/function.error-reporting.php
90
-
# See https://www.php.net/manual/en/errorfunc.constants.php
91
-
error_level: E_ALL & ~E_STRICT & ~E_DEPRECATED
117
+
Bootstrap script that will be executed before current suite. A script should be put into suite directory.
92
118
93
-
{% endhighlight %}
119
+
### `coverage`
94
120
95
-
*`modules`: allows to create shared module configuration for all included suites.
121
+
Per suite [CodeCoverage](https://codeception.com/docs/11-Codecoverage#Configuration) settings.
96
122
97
-
{% highlight yaml %}
123
+
### `env`
98
124
99
-
modules:
100
-
config:
101
-
Db:
102
-
dsn: ''
103
-
user: ''
104
-
password: ''
105
-
dump: tests/_data/dump.sql
125
+
Override any configuration per [environment](https://codeception.com/docs/07-AdvancedUsage#Environments).
106
126
107
-
{% endhighlight %}
108
-
*`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.
109
-
*`extensions`: allows to enable and configure [Codeception extensions](https://codeception.com/docs/08-Customization#Extension), [Group Objects](https://codeception.com/docs/08-Customization#Group-Objects), and [Custom Commands](https://codeception.com/docs/08-Customization#Custom-Commands).
110
-
*`reporters`: allows to [change default reporters](https://codeception.com/docs/08-Customization#Custom-Reporters) of Codeception
*`params`: allows to pass [external parameters](https://codeception.com/docs/06-ModulesAndHelpers#Dynamic-Configuration-With-Parameters) into module configuration.
*`bootstrap`: bootstrap script that will be executed before all suites. A script should be put into `tests` directory.
127
+
### `error_level`
115
128
116
-
## Suite Configuration
129
+
[error level](https://codeception.com/docs/04-FunctionalTests#Error-Reporting) for runner in the current suite. Can be specified for unit, integration, functional tests. Passes value to `error_reporting` function.
117
130
118
-
Each generated suite have its own configuration inside directory set by `paths: tests: ` configuration option in `codeception.yml`. Each suite configuration is named like `suitename.suite.yml`. It allows to enable and configure modules, and more.
131
+
### `extends`
119
132
120
-
*`actor`: name of the actor class for current suite.
121
-
*`modules`: list of enabled modules with their configuration.
133
+
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.
122
134
123
-
{% highlight yaml %}
135
+
### `gherkin`
124
136
137
+
Per suite [Gherkin](https://codeception.com/docs/07-BDD#Configuration) settings.
138
+
139
+
### `groups`
140
+
141
+
[groups](https://codeception.com/docs/07-AdvancedUsage#Groups) with the list of tests of for corresponding group.
142
+
143
+
### `formats`
144
+
145
+
[formats](https://codeception.com/docs/07-AdvancedUsage#Formats) with the list of extra test format classes.
146
+
147
+
### `modules`
148
+
149
+
List of enabled modules with their configuration.
150
+
151
+
{% highlight yaml %}
125
152
modules:
126
-
# enabled modules and helpers
127
153
enabled:
128
-
# built-in modules are listed by their names
129
-
- PhpBrowser:
130
-
# module configuration
131
-
url: http://localhost
132
-
# this module is pre-configured in global config
133
-
- Db
134
-
135
-
# helper names are listed by their class names
136
-
# by convention their names start with \
137
-
- \Helper\Acceptance
138
-
139
-
# additional modules configuration
140
-
# can be used for modules which are not currently enabled
154
+
- PhpBrowser: # built-in modules are listed by their names
155
+
url: http://localhost # module configuration
156
+
- Db # Module without configuration (or inherited from `codeception.yml`)
157
+
- \Helper\Acceptance # helper names are listed by their class names, starting with `\`
158
+
159
+
# Additional modules configuration; can be used for modules which are not currently enabled
141
160
config:
142
161
WebDriver:
143
162
browser: firefox
144
163
145
-
# list of modules disabled for this suite
146
164
disabled:
147
-
- WebDriver
165
+
- WebDriver # modules disabled for this suite
166
+
{% endhighlight %}
148
167
168
+
### `namespace`
149
169
150
-
{% endhighlight %}
170
+
Default namespace of actor, support classes and tests.
171
+
172
+
### `suite_namespace`
173
+
174
+
Default namespace for new tests of this suite (ignores `namespace` option)
151
175
152
-
*`extends`: allows you to specify a file (relative to the `*.suite.yml` file) that holds some already pre-defined values. This can be used to always use the same configuration for modules or whatever.
153
-
*`namespace`: default namespace of actor, support classes and tests.
154
-
*`suite_namespace`: default namespace for new tests of this suite (ignores `namespace` option)
155
-
*`env`: override any configuration per [environment](https://codeception.com/docs/07-AdvancedUsage#Environments).
156
-
*`groups`: [groups](https://codeception.com/docs/07-AdvancedUsage#Groups) with the list of tests of for corresponding group.
157
-
*`formats`: [formats](https://codeception.com/docs/07-AdvancedUsage#Formats) with the list of extra test format classes.
158
-
*`coverage`: per suite [CodeCoverage](https://codeception.com/docs/11-Codecoverage#Configuration) settings.
159
-
*`gherkin`: per suite [BDD Gherkin](https://codeception.com/docs/07-BDD#Configuration) settings.
160
-
*`error_level`: [error level](https://codeception.com/docs/04-FunctionalTests#Error-Reporting) for runner in current suite. Can be specified for unit, integration, functional tests. Passes value to `error_reporting` function. Suite specific value will override the global value.
161
-
*`bootstrap`: bootstrap script that will be executed before current suites. A script should be put into suite directory.
162
-
163
-
## Config Templates (dist)
176
+
## Configuration Templates: `*.dist.yml`
164
177
165
178
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.
0 commit comments