miamioh/behat-sensu-formatter

该包的最新版本(v0.6.1)没有可用的许可证信息。

创建此包是为了允许在sensu监控框架中使用behat测试

v0.6.1 2018-01-10 13:51 UTC

This package is not auto-updated.

Last update: 2024-09-29 04:09:04 UTC


README

先决条件

此扩展需要

  • PHP 7.0 或更高版本
  • Behat 3.x 或更高版本

使用composer安装

$ composer require miamioh/behat-sensu-formatter

基本用法

通过在您的 behat.yml 中指定其类来激活扩展

# behat.yml
default:
    suites:
    ...

    extensions:
      miamioh\BehatSensuFormatter\BehatSensuFormatterExtension: ~
    ...

然后将其添加为 behat.yml 中的格式化程序

#behat.yml
  ...
  formatters:
    SensuFormatter: ~
  ...

指标检查类型

如果检查是指标检查,则需要做出一些更改,具体取决于检查。

#behat.yml
  ...
  extensions:
    miamioh\BehatSensuFormatter\BehatSensuFormatterExtension:
      checkType: 'metric'
  ...

这将向输出添加3行指标

  behat.tests.run 2 1515546664
  behat.tests.passed 2 1515546664
  behat.tests.failed 0 1515546664
  OK: All 2 tests passed

指标的描述、指标值和指标创建的时间戳。这些信息然后可以被Graphite用来显示通过和失败的测试图表。

此外,您还可以向yml文件中添加metricPreface参数,以便在测试运行时预先添加有关测试运行的具体信息。

根据检查的不同,可能需要进行一些更改。因此,可能是 metricPreface: 'test.myapp' 或类似 metricPreface: 'test.chrome.myapp',如果您想收集在针对chrome而不是safari运行测试时的所有测试指标。当添加这个前缀时,输出将是

  test.chrome.myapp.behat.tests.run 2 1515546664
  test.chrome.myapp.behat.tests.passed 2 1515546664
  test.chrome.myapp.behat.tests.failed 0 1515546664
  OK: All 2 tests passed