ekandreas / testrunner
此包的最新版本(0.3.1)没有提供许可信息。
0.3.1
2016-01-11 22:53 UTC
This package is auto-updated.
Last update: 2024-09-25 21:12:12 UTC
README
*** 进行中 ***
当你为WordPress开发插件时,构建测试用例并持续使用它们也很重要。
此包是一个辅助工具,可以在你的插件文件夹内运行测试,但使用Docker作为测试实例和报告生成器。
测试套件应放置在将要进行测试的插件中。
root
│ wp-admin
└───wp-content
├───plugins
│ ├───your-plugin <- install with composer require ekandreas/testrunner:*
│ │ ...
注意!第一次运行将花费较长时间,因为需要创建镜像和安装wordpress-develop文件夹等。
要持续运行插件测试,请使用部分测试命令
dep tests:run
要求
- 带有VirtualBox的Docker-machine
- PHP Composer
设置
使用Composer安装此库,例如
composer require ekandreas/testrunner:dev-master
现在在你的插件根目录中创建部署文件,例如
<!-- deploy.php --> date_default_timezone_set('Europe/Stockholm'); include_once 'vendor/ekandreas/testrunner/recipe.php';
现在你可以使用以下部署命令享受Docker测试
vendor/bin/dep tests
这仅是第一次,大约需要10分钟。
并且使用持续测试
vendor/bin/dep tests:run
测试报告只需几秒钟。
部署文件示例
<!-- deploy.php --> <?php date_default_timezone_set('Europe/Stockholm'); include_once 'vendor/ekandreas/testrunner/recipe.php'; set( 'docker_host_name', 'tests');
完整运行
vendor/bin/dep tests
部分运行
启动Docker并执行安装
dep tests:up
重建Docker容器镜像
dep tests:rebuild
仅运行测试(在tests:up之后)
dep tests:run
停止测试
这将终止容器
dep tests:stop
终止Docker机器
这将终止虚拟测试机器
dep tests:kill
食谱参数,选项
如果您不想使用默认的docker-machine,请定义自己的,例如
<!-- deploy.php --> date_default_timezone_set('Europe/Stockholm'); include_once 'vendor/ekandreas/testrunner/recipe.php'; set( 'docker_host_name', 'tests');
如果您没有设置docker机器,则部署脚本将尝试为您创建它。默认使用Virtualbox。
待办事项
- 只需一个单独的命令
dep tests
来检查并启动mysql(如果缺失则安装)。