qase/pest-reporter
Composer 安装命令:
composer require --dev qase/pest-reporter
包简介
Qase TMS reporter for Pest PHP testing framework
README 文档
README
A Qase TMS reporter for Pest PHP testing framework.
Installation
composer require --dev qase/pest-reporter
Configuration
1. Add PHPUnit Extension
Add the Qase extension to your phpunit.xml:
<?xml version="1.0" encoding="UTF-8"?> <phpunit> <extensions> <bootstrap class="Qase\PestReporter\QaseExtension"/> </extensions> <!-- ... --> </phpunit>
2. Create Configuration File
Create qase.config.json in your project root:
{
"mode": "testops",
"fallback": "report",
"testops": {
"api": {
"token": "YOUR_QASE_API_TOKEN",
"host": "qase.io"
},
"project": "YOUR_PROJECT_CODE",
"run": {
"title": "Pest Test Run",
"complete": true
}
},
"report": {
"driver": "local",
"connection": {
"path": "./build/qase-report"
}
}
}
Or use environment variables:
QASE_MODE=testops QASE_TESTOPS_API_TOKEN=your_token QASE_TESTOPS_PROJECT=PROJECT_CODE
Usage
Fluent API (Recommended)
use function Qase\PestReporter\qase; it('logs in successfully', function () { qase() ->caseId(123) ->title('Login Test') ->suite('Auth', 'Login') ->field('priority', 'high') ->parameter('browser', 'chrome') ->step('Open login page') ->step('Submit credentials', function () { expect(true)->toBeTrue(); }) ->comment('Testing login functionality') ->attach('/path/to/screenshot.png'); });
Static Facade
use Qase\PestReporter\Qase; it('logs in successfully', function () { Qase::caseId(123); Qase::title('Login Test'); Qase::comment('Testing login'); expect(true)->toBeTrue(); });
API Reference
Fluent API Methods
| Method | Description |
|---|---|
caseId(int ...$ids) |
Link test to Qase test case(s) |
title(string $title) |
Set custom test title |
suite(string ...$suites) |
Set suite hierarchy |
field(string $name, string $value) |
Set custom field |
parameter(string $name, string $value) |
Set test parameter |
comment(string $message) |
Add comment |
attach(mixed $input) |
Add attachment |
step(string $action, ?callable $callback, ?string $expectedResult) |
Add test step |
Static Facade Methods
| Method | Description |
|---|---|
Qase::caseId(int ...$ids) |
Link test to Qase test case(s) |
Qase::title(string $title) |
Set custom test title |
Qase::suite(string ...$suites) |
Set suite hierarchy |
Qase::field(string $name, string $value) |
Set custom field |
Qase::parameter(string $name, string $value) |
Set test parameter |
Qase::comment(string $message) |
Add comment |
Qase::attach(mixed $input) |
Add attachment |
Qase::step(string $action, ?callable $callback, ?string $expectedResult) |
Add test step |
Attachments
File Attachment
qase()->attach('/path/to/file.png');
Multiple Files
qase()->attach(['/path/to/file1.png', '/path/to/file2.log']);
Content Attachment
qase()->attach((object)[ 'title' => 'response.json', 'content' => json_encode($response), 'mime' => 'application/json' ]);
Steps
Add test steps to structure your test execution in Qase TMS.
Simple Step Markers
qase()->step('Open login page'); qase()->step('Enter credentials'); qase()->step('Click submit');
Steps with Callbacks
Callbacks provide automatic timing and status tracking (passed/failed):
qase()->step('Fill login form', function () { // step body — auto-timed, status set to passed/failed expect(true)->toBeTrue(); });
Nested Steps
qase()->step('Login flow', function () { qase()->step('Enter credentials', function () { // nested step }); qase()->step('Click submit'); });
Steps with Expected Result
qase()->step('Click login', expectedResult: 'Dashboard page loads');
Static Facade Steps
use Qase\PestReporter\Qase; Qase::step('Open page', function () { /* ... */ }); Qase::step('Verify footer', expectedResult: 'Footer is visible');
Steps in Fluent Chain
qase() ->caseId(123) ->step('Open page') ->step('Fill form', function () { /* ... */ }) ->step('Submit', expectedResult: 'Success message shown') ->comment('All steps passed');
Data Providers
The reporter automatically extracts parameters from Pest's data providers:
it('adds numbers', function (int $a, int $b, int $expected) { qase()->caseId(100); expect($a + $b)->toBe($expected); })->with([ 'one plus one' => [1, 1, 2], 'two plus two' => [2, 2, 4], ]);
Suite Hierarchy
Use describe() blocks for automatic suite hierarchy, or set manually:
describe('Authentication', function () { describe('Login', function () { it('logs in with valid credentials', function () { qase()->caseId(1)->comment('Testing login'); expect(true)->toBeTrue(); }); }); }); // Or set manually: it('test with custom suite', function () { qase()->suite('API', 'Users', 'Create'); expect(true)->toBeTrue(); });
Running Tests
# With local report ./vendor/bin/pest # With Qase TMS integration QASE_MODE=testops ./vendor/bin/pest
Requirements
- PHP 8.2+
- Pest 2.0+ or 3.0+
- PHPUnit 10, 11, or 12
License
Apache License 2.0
Links
qase/pest-reporter 适用场景与选型建议
qase/pest-reporter 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 22.25k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「testing」 「reporter」 「pest」 「tms」 「qase」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 qase/pest-reporter 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 qase/pest-reporter 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 qase/pest-reporter 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Provides a TAP result printer for PHPUnit.
Testing Suite For Lumen like Laravel does.
An interface to report and relay arbitrary messages to registered handlers, plus test doubles
Qase TMS Codeception reporter.
PHP CS Fixer reporter for Bitbucket Pipeline Reports
Bootstraps errors and handles them via reporters and renderers
统计信息
- 总下载量: 22.25k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2026-02-05