naldz/grootest 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

naldz/grootest

Composer 安装命令:

composer require naldz/grootest

包简介

GrooTest is collection of libraries primarily used for functional testing

README 文档

README

What is GrooTest

GrooTest is collection of libraries primarily used for functional testing. It provides base classes for database tests, web tests and page objects. It also provides fixture management for tests.

Requirements

  • GrooTest is only supported on PHP 5.3 and up.
  • PHPUnit 3.7 and uip
  • PHPUnit DBUnit Extension

Installation

composer require naldz/GrooTest

Configuration

GrooTest reads configuration data from the $_ENV variable. A prefix variable in which GrooTest will based the name of the configuration variables should be provided. The best way to defined these environment variables is through a phpunit.xml config file.

Example:

<php>
        <env name="GROOTEST_CONFIG_PREFIX" value="TEST_CONFIG_" />
        <env name="TEST_CONFIG_SELENIUM_HOST" value="http://localhost:4444/wd/hub" />
        <env name="TEST_CONFIG_DSN" value="sqlite:/path/db.sqlite" />
</php>

With the configuration example above, GrooTest will use the 'TEST_CONFIG_' text as a prefix for all test configuration data. The 'TEST_CONFIG_SELENIUM_HOST' environment variable will be read and saved as SELENIUM_HOST config data with a value of 'http://localhost:4444/wd/hub' and the TEST_CONFIG_DSN as DSN with value of 'sqlite:/path/db.sqlite'. The configuration data now looks like this:

array(
    "SELENIUM_HOST" => "http://localhost:4444/wd/hub",
    "DSN" => "sqlite:/path/db.sqlite"
)

This configuration map is saved into a Configuration object (Naldz\GrooTest\Config\Configuration) which is a protected property (config) of the WebTestCase class.

It is also important to instantiate the Configuration object on the bootrap file and assign it to the "GROOTEST_CONFIG" environment variable.

use Naldz\GrooTest\Config\ConfigurationManager;
use Naldz\GrooTest\Config\Configuration;

$configManager = new ConfigurationManager();
$configData = $configManager->getConfigurationData();
$_ENV['GROOTEST_CONFIG'] = new Configuration($configData);

Test Cases

It is always a good idea to create a TestCase class that will serve as a base test case of your project. This TestCase class should extend from the WebTestCase (Naldz\GrooTest\Tests\TestCase\WebTestCase) class which is a subclass of the DatabaseTestCase (Naldz\GrooTest\Tests\TestCase\DatabaseTestCase) class. The DatabaseTestCase is also a subclass of the PHPUnit_Extensions_Database_TestCase which is an abstract class provided by the DBUnit PHPUnit extension. The hierarchy of classes is illustrated below:

PHPUnit_Extensions_Database_TestCase
  |
  |
  -- DatabaseTestCase \\ Responsible for fixture loading
       |
       |
       -- WebTestCase \\ Responsible for defining objects related to Selenium
            |
            | 
            -- ProjectTestCase \\ Should implement the abstract method 'getConnection' and definition of fixture sets

naldz/grootest 适用场景与选型建议

naldz/grootest 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12 次下载、GitHub Stars 达 0, 最近一次更新时间为 2014 年 12 月 15 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「functional testing」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 naldz/grootest 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 naldz/grootest 我们能提供哪些服务?
定制开发 / 二次开发

基于 naldz/grootest 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 12
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 20
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-12-15