【发布时间】:2018-12-12 16:00:22
【问题描述】:
我需要在每次验收测试后恢复通过验收测试在数据库中所做的所有更改。
如 Yii2 文档中所述,您应该在 acceptance.suite.yml 中为 Yii2 模块设置 transaction: false。
你应该在codeception.yml 中将cleanup: true and transaction: true 用于Db 模块。
实际:验收测试在数据库中所做的更改未还原。
预期:验收测试在数据库中所做的更改被还原。
codeception.yml
namespace: common\tests
actor_suffix: Tester
paths:
tests: tests
output: tests/_output
data: tests/_data
support: tests/_support
settings:
bootstrap: _bootstrap.php
colors: true
memory_limit: 1024M
modules:
config:
Yii2:
configFile: 'config/test-local.php'
Db:
dsn: '%TEST_DB_TYPE%:host=%TEST_DB_HOST%;port=%TEST_DB_PORT%;dbname=%TEST_DB_NAME%'
user: '%TEST_DB_USERNAME%'
password: '%TEST_DB_PASSWORD%'
cleanup: true
transaction: true
params:
- config/params-local.php
acceptance.suite.yml
suite_namespace: frontend\tests\acceptance
actor: AcceptanceTester
modules:
enabled:
- WebDriver
- Yii2
config:
Yii2:
part: init
transaction: false
cleanup: true
WebDriver:
browser: chrome
url: 'http://mysite.dev/'
port: 9515 # ChromeDriver port
window_size: 1920x1080
clear_cookies: true
restart: true
capabilities:
chromeOptions:
args: ["--headless", "--disable-gpu"]
binary: "/usr/bin/google-chrome-stable"
extensions:
enabled:
- Codeception\Extension\RunProcess:
- chromedriver --url-base=/wd/hub
【问题讨论】:
标签: yii2 codeception acceptance-testing