我遇到了与Symfony结合的Codeception问题。我想从几个捆绑包中运行几个测试套件,只有一个运行命令
./bin/codeception run
项目结构如下:
my-bundle-application
+--- app
+--- bin
+--- ...
+--- codeception.yml // the main codeception file
+--- tests
+--- packages
| +--- my-bundle
| +--- my-core-bundle
| +--- app
| +--- bin
| +--- ...
| +--- src
| +--- Controller
| +--- Model
| +--- ...
| +--- MyCoreBundle.php
| +--- tests // codecetpion tests directory
| +--- _data
| +--- _support
| +--- api
| +--- _bootstrap.php
| +--- api.suite.yml
| +--- codeception.yml // subfolder codeception file
| +--- composer.json (see below)
| +--- my-order-bundle
| +--- app
| +--- src
| +--- Controller
| +--- Model
| +--- ...
| +--- MyOrderBundle.php
| +--- bin
| +--- ...
| +--- tests
| +--- codeception.yml // subfolder codeception file
我希望从我的主捆绑包以及我的包捆绑包中执行所有测试套件。 (my-bundle-application + my-core-bundle + my-order-bundle ....)
我想知道是否有可能。我在主要的codeception.yml中考虑了'include'选项,但事情并非如此简单,我所做的每一个测试都给出了同样的错误。
[Codeception\Exception\ConfigurationException]
Configuration file could not be found.
Run `bootstrap` to initialize Codeception.
这是我的主要codeception.yml文件:
actor: Tester
paths:
tests: tests
log: tests/_output
data: tests/_data
support: tests/_support
envs: tests/_envs
settings:
bootstrap: _bootstrap.php
colors: true
memory_limit: 1024M
extensions:
enabled:
- Codeception\Extension\RunFailed
modules:
config:
Db:
dsn: ''
user: ''
password: ''
dump: tests/_data/dump.sql
include:
- MyBundle\CoreBundle // This give an error
其他Codeception文件类似,没有include选项。
最后这是我的一个子Bundle
的composer.json{
"name": "my-bundle/my-core-bundle",
"type": "symfony-bundle",
"license": "proprietary",
"description": "Bundle to manage core features.",
"autoload": {
"psr-4": { "MyBundle\\CoreBundle\\": "src/" }
},
...
}
也许我没有正确使用Codeception,或者没有办法做到这一点,但我不确定。 这个github问题也可以帮助:https://github.com/Codeception/Codeception/issues/319