drupaltest/behat-traits
Composer 安装命令:
composer require drupaltest/behat-traits
包简介
A collection of traits that help to quickly develop custom Context classes for testing Drupal sites using Behat.
README 文档
README
A collection of traits that help to quickly develop custom Context classes for testing Drupal sites using Behat.
The following traits are included:
BrowserCapabilityDetectionTrait: allows to detect whether a scenario is using a browser that supports JavaScript. This can be used to write step definitions that can interact both with JavaScript behaviors and non-JS fallbacks.EntityTrait: provides methods that allow to interact with entities using human readable names in step definitions, and translate them to machine names.PageCacheTrait: allows to write step definitions that are aware of whether the page that is currently loaded is cached or cacheable.
Each of these traits come with an example context that include some step definitions to demonstrate how to use the traits.
Requirements
This depends on the following software:
Installation
Install the package and its dependencies. Since this is intended to be used for
testing, use the --dev option to install it as a development dependency:
$ composer require --dev drupaltest/behat-traits
Usage
The project offers a number of traits that help to quickly create custom Behat Context classes by performing common tasks that are typically needed in step definitions for Drupal projects.
For some examples on how this can be used, see the test contexts in the
./src/Context/ folder.
Setting up a development environment
If you want to contribute to Behat Traits you can install a local development environment for it by executing the following steps:
Step 0: Clone the repository
$ git clone https://github.com/drupaltest/behat-traits.git
$ cd behat-traits
Using a local LAMP stack
Step 1: Install dependencies
$ composer install
Step 2: Configure the environment
Copy runner.yml.dist to runner.yml and change the configuration to match
your local environment. Typically you will need to specify localhost as your
database host, and change your base URL and database credentials.
Step 3: Build
$ ./vendor/bin/run drupal:site-setup
This will symlink the module in the proper directory within the test environment and perform token substitution in test configuration files.
Step 4: Install
$ ./vendor/bin/run drupal:site-install
Your test site will be available at ./build.
Using Docker Compose
Step 0: Download images
$ docker-compose up -d
Step 1: Install dependencies
$ docker-compose exec web composer install
Step 2: Configure the environment
Copy runner.yml.dist to runner.yml and change the configuration to match
your local environment if needed. Usually this can be skipped since the module
ships with default configuration that matches the Docker environment.
Step 3: Build
$ docker-compose exec web ./vendor/bin/run drupal:site-setup
This will symlink the module in the proper directory within the test environment and perform token substitution in test configuration files.
Step 4: Install
$ docker-compose exec web ./vendor/bin/run drupal:site-install
Your test site will be available at http://localhost:8080/build.
Running tests
Using a local LAMP stack
Coding standards
$ ./vendor/bin/grumphp run
Behat tests
$ ./vendor/bin/behat
Using Docker Compose
Coding standards
$ docker-compose exec web ./vendor/bin/grumphp run
Behat tests
$ docker-compose exec web ./vendor/bin/behat
drupaltest/behat-traits 适用场景与选型建议
drupaltest/behat-traits 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 28.64k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2019 年 04 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 drupaltest/behat-traits 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 drupaltest/behat-traits 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 28.64k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: EUPL-1.2
- 更新时间: 2019-04-03