Mah*_*alt 2 php testing phpunit unit-testing codeception
我有以下文件夹结构,我希望在不同的目录中存在多个测试套件.
- project
- app
- app-A
- tests
- (functional tests here)
- app-B
- tests
- (functional tests here)
- domains
- domain-A
- tests
- (unit tests here)
- domain-B
- tests
- (unit tests here)
Run Code Online (Sandbox Code Playgroud)
1. codeception.yml在项目的根目录中创建文件
2.超过该文件中的以下内容:
include:
-
paths:
log: log
settings:
colors: true
Run Code Online (Sandbox Code Playgroud)
3.在子目录中生成一些测试套件:
codecept bootstrap /.../src/Domains/User --namespace user
codecept bootstrap /.../src/Application/Cms --namespace cms
Run Code Online (Sandbox Code Playgroud)
4. codeception.yml通过在includes下包含测试套件的路径来更新 根目录.
include:
- src/Domains/User
- src/Application/Cms
Run Code Online (Sandbox Code Playgroud)
5.生成一些测试
codecept generate:cept --config src/Domains/User unit testB
codecept generate:cept --config src/Applications/Cms functional testA
Run Code Online (Sandbox Code Playgroud)
6.运行测试
codecept run
Run Code Online (Sandbox Code Playgroud)