承接 kolyunya/codeception-markup-validator 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

kolyunya/codeception-markup-validator

Composer 安装命令:

composer require kolyunya/codeception-markup-validator

包简介

Markup validator module for Codeception.

README 文档

README

Latest Stable Version Build Status PHPStan Scrutinizer Code Quality Code Climate

Problem

Programmatically validate markup of web application pages during automated acceptance testing.

Solution

Markup validator module for Codeception. Validates web-pages markup (HTML, XHTML etc.) using markup validators e.g. W3C Markup Validator Service. Don't let invalid pages reach production. Add some zero effort tests to your acceptance suite which will immediately inform you when your markup gets broken.

$I->amOnPage('/');
$I->validateMarkup();

Dead simple to use. Requires literally no configuraton. Works as you expect it out of box. Fully configurable and extendable if you want to hack it. Each component of the module can be replaced with your custom class. Just implement a simple interface and inject custom component to the module.

Installation

The recommended way of module installation is via composer:

composer require --dev kolyunya/codeception-markup-validator

Usage

Add the module to your acceptance test suit configuration:

class_name: AcceptanceTester
modules:
    enabled:
        - PhpBrowser:
            url: 'http://localhost/'
        - Kolyunya\Codeception\Module\MarkupValidator

Build the test suit:

codecept build

Validate markup:

$I->amOnPage('/');
$I->validateMarkup();

If you need, you may override module-wide message filter configuration for each page individually like this:

// Perform very strict checks for this particular page.
$I->amOnPage('/foo/');
$I->validateMarkup(array(
    'ignoreWarnings' => false,
));

// Ignore those two errors just on this page.
$I->amOnPage('/bar/');
$I->validateMarkup(array(
    'ignoredErrors' => array(
        '/some error/',
        '/another error/',
    ),
));

// Set error count threshold, do not ignore warnings
// but ignore some errors on this page.
$I->amOnPage('/quux/');
$I->validateMarkup(array(
    'errorCountThreshold' => 10,
    'ignoreWarnings' => false,
    'ignoredErros' => array(
        '/this error/',
        '/that error/',
    ),
));

Configuration

The module does not require any configuration. The default setup will work if you have either PhpBrowser or WebDriver modules enabled.

Nevertheless the module is fully-configurable and hackable. It consist of four major components: provider which provides markup to validate, validator which performs actual markup validation, filter which filters messages received from the validator and printer which determines how to print messages received from the validator. You may configure each of the components with a custom implementation.

Provider

The module may be configured with a custom provider which will provide the markup to the validator. The default provider tries to obtain markup from the PhpBrowser and WebDriver modules.

class_name: AcceptanceTester
modules:
    enabled:
        - PhpBrowser:
            url: 'http://localhost/'
        - Kolyunya\Codeception\Module\MarkupValidator:
            provider:
                class: Acme\Tests\Path\To\CustomMarkupProvider

Validator

The module may be configured with a custom validator which will validate markup received from the provider. The default validator uses the W3C Markup Validation Service API.

class_name: AcceptanceTester
modules:
    enabled:
        - PhpBrowser:
            url: 'http://localhost/'
        - Kolyunya\Codeception\Module\MarkupValidator:
            validator:
                class: Acme\Tests\Path\To\CustomMarkupValidator

Filter

The module may be configured with a custom filter which will filter messages received from the validator. You may implement you own filter or tweak a default one.

class_name: AcceptanceTester
modules:
    enabled:
        - PhpBrowser:
            url: 'http://localhost/'
        - Kolyunya\Codeception\Module\MarkupValidator:
            filter:
                class: Kolyunya\Codeception\Lib\MarkupValidator\DefaultMessageFilter
                config:
                    errorCountThreshold: 10
                    ignoreWarnings: true
                    ignoredErrors:
                        - '/some error/'
                        - '/another error/'

Printer

The module may be configured with a custom printer which defines how messages received from the validator are printed. The default printer prints message type, summary, details, first line number, last line number and related markup.

class_name: AcceptanceTester
modules:
    enabled:
        - PhpBrowser:
            url: 'http://localhost/'
        - Kolyunya\Codeception\Module\MarkupValidator:
            printer:
                class: Acme\Tests\Path\To\CustomMessagePrinter

Contributing

If you found a bug or have a feature request feel free to open an issue. If you want to send a pull request, backward-compatible changes should target the master branch while breaking changes - the next major version branch.

kolyunya/codeception-markup-validator 适用场景与选型建议

kolyunya/codeception-markup-validator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 13.87k 次下载、GitHub Stars 达 13, 最近一次更新时间为 2017 年 04 月 20 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 kolyunya/codeception-markup-validator 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 13
  • Watchers: 2
  • Forks: 9
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0-or-later
  • 更新时间: 2017-04-20