定制 adamquaile/behat-command-runner-extension 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

adamquaile/behat-command-runner-extension

最新稳定版本:v0.1.1

Composer 安装命令:

composer require adamquaile/behat-command-runner-extension

包简介

Extension to run commands at hooks in test lifecycle

README 文档

README

This is a proof-of-concept - use with caution!

Extension to run commands at hooks in test lifecycle, useful for cache clearing, database setup, teardown, etc...

Installation

Require package adamquaile/behat-command-runner-extension via composer:

composer require --dev "adamquaile/behat-command-runner-extension *@dev"

Add configuration to your behat.yml. This example shows the full configuration options.

default:
    extensions:
        AdamQuaile\Behat\CommandRunnerExtension:
              beforeSuite:
                  - echo "beforeSuite"
                  - { command: 'ping example.com', background: true }
              afterSuite:
                  - echo "afterSuite"
              beforeFeature:
                  - echo "beforeFeature"
                  - { command: 'ping example.com', background: true }
              afterFeature:
                  - echo "afterFeature"
              beforeScenario:
                  - echo "beforeScenario"
                  - { command: 'ping example.com', background: true }
              afterScenario:
                  - echo "afterScenario"

A symfony2 example

This example runs phantomjs for our javascript behat tests, and also creates and recreates a test database for each feature.

For speed, the database is copied back into place after the first run during setup rather than using doctrine each time.

For more isolation, you could do this copying on beforeScenario rather than beforeFeature.

default:
    extensions:
        AdamQuaile\Behat\CommandRunnerExtension:
              beforeSuite:
                  - rm app/var/test.db 
                  - php app/console --env=test doctrine:database:drop --force
                  - php app/console --env=test doctrine:database:create --force
                  - php app/console --env=test doctrine:schema:update --force
                  - cp app/var/test.db app/var/test.initial.db
                  - { command: 'phantomjs-1.9.7-linux-x86_64/bin/phantomjs" --webdriver=4444  >"phantomjs.log"', background: true }
              beforeFeature:
                  - cp app/var/test.initial.db app/var/test.db

统计信息

  • 总下载量: 182.43k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 14
  • 点击次数: 1
  • 依赖项目数: 4
  • 推荐数: 0

GitHub 信息

  • Stars: 14
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2015-04-22