2e86c939
xu
“首次提交”
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
# Configuration
## Global Configuration
Configuration file `codeception.yml` is generated by `codecept bootstrap` command. It has preconfigured settings you can change.
Here are global options you can change inside configuration:
* `actor: 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.
* `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](http://codeception.com/docs/08-Customization#Namespaces).
* `include: []`: include additional Codeception configurations for [multiple applications setup](http://codeception.com/docs/08-Customization#Namespaces).
* `paths` directories used by Codeception. Default values are:
```yaml
paths:
# where the tests stored
tests: tests
# directory for fixture data
data: tests/_data
# directory for support code
support: tests/_support
# directory for output
log: tests/_output
# directory for environment configuration
envs: tests/_envs
```
* `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.
```yaml
settings:
# name of bootstrap that will be used
# each bootstrap file should be
# inside a suite directory.
bootstrap: _bootstrap.php
# 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
lint: true
# randomize test order
shuffle: true
# by default it's false on Windows
# use [ANSICON](https://github.com/adoxa/ansicon) to colorize output.
colors: true
# Generate XML JUnit report using strict schema
# Avoid putting additional report fields like steps or scenario names tot it
# Required for XML reports on Jenkins CI
strict_xml: false
# Tests (especially functional) can take a lot of memory
# We set a high limit for them by default.
memory_limit: 1024M
# This value controls whether PHPUnit attempts to backup global variables
# See https://phpunit.de/manual/current/en/appendixes.annotations.html#appendixes.annotations.backupGlobals
backup_globals: true
# 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
report_useless_tests: 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
disallow_test_output: 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
be_strict_about_changes_to_global_state: false
# Log the incomplete and skipped tests into junit report
# See https://phpunit.de/manual/current/en/appendixes.configuration.html
# Section logging > junit
log_incomplete_skipped: false
```
* `modules`: allows to create shared module configuration for all included suites. By default sample configuration for Db module is included.
```yaml
modules:
config:
Db:
dsn: ''
user: ''
password: ''
dump: tests/_data/dump.sql
```
* `extensions`: allows to enable and configure [Codeception extensions](http://codeception.com/docs/08-Customization#Extension), [Group Objects](http://codeception.com/docs/08-Customization#Group-Objects), and [Custom Commands](http://codeception.com/docs/08-Customization#Custom-Commands).
* `reporters`: allows to [change default reporters](http://codeception.com/docs/08-Customization#Custom-Reporters) of Codeception
* `coverage`: [CodeCoverage](http://codeception.com/docs/11-Codecoverage#Configuration) settings.
* `params`: allows to pass [external parameters](http://codeception.com/docs/06-ModulesAndHelpers#Dynamic-Configuration-With-Params) into module configuration.
* `gherkin`: BDD-specific [Gherkin options](http://codeception.com/docs/07-BDD#Configuration).
## Suite Configuration
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.
* `actor`: name of the actor class for current suite.
* `modules`: list of enabled modules with their configuration.
```yaml
modules:
# enabled modules and helpers
enabled:
# built-in modules are listed by their names
- PhpBrowser:
# module configuration
url: http://localhost
# this module is pre-configured in global config
- Db
# helper names are listed by their class names
# by convention their names start with \
- \Helper\Acceptance
# additional modules configuration
# can be used for modules which are not currently enabled
config:
WebDriver:
browser: firefox
# list of modules disabled for this suite
disabled:
- WebDriver
```
* `namespace`: default namespace of actor, support classes and tests.
* `env`: override any configuration per [environment](http://codeception.com/docs/07-AdvancedUsage#Environments).
* `groups`: [groups](http://codeception.com/docs/07-AdvancedUsage#Groups) with the list of tests of for corresponding group.
* `coverage`: pre suite [CodeCoverage](http://codeception.com/docs/11-Codecoverage#Configuration) settings.
* `gherkin`: per suite [BDD Gherkin](http://codeception.com/docs/07-BDD#Configuration) settings.
* `error_level`: [error level](http://codeception.com/docs/04-FunctionalTests#Error-Reporting) for runner in current suite. Should be specified for unit, integration, functional tests. Passes value to `error_reporting` function.
## Config Templates (dist)
To provide same configuration templates for development team you can creare `codeception.dist.yml` config which will be loaded before `codeception.yml`. Dist config will provide shared options whil local `codeception.yml` will override them per user basis. This way `codeception.yml` should be ignored by VCS system.
For suite configuration template configs are also availble. Rename `suitename.suite.yml` to `suitename.dist.yml` to make a dist config.
Configuration loading order:
1. `codeception.dist.yml`
2. `codeception.yml`
3. `acceptance.suite.dist.yml`
4. `acceptance.suite.yml`
5. environment config
|