定制 qase/phpunit-reporter 二次开发

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

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

qase/phpunit-reporter

最新稳定版本:2.1.6

Composer 安装命令:

composer require qase/phpunit-reporter

包简介

Qase PHPUnit reporter

README 文档

README

Publish test results easily and efficiently.

Installation

To install the latest version, run:

composer require qase/phpunit-reporter 

Add the following lines to the phpunit.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="./vendor/autoload.php">
    <extensions>
        <bootstrap class="Qase\PHPUnitReporter\QaseExtension"/>
    </extensions>
</phpunit>

Getting Started

The PHPUnit reporter can auto-generate test cases and suites based on your test data. Test results of subsequent test runs will match the same test cases as long as their names and file paths don’t change.

You can also annotate tests with the IDs of existing test cases from Qase.io before executing them. This is a more reliable way to bind automated tests to test cases, ensuring they persist when you rename, move, or parameterize your tests.

For more information, refer to the Usage Guide.

For example:

<?php

namespace Tests;

use Exception;
use PHPUnit\Framework\TestCase;
use Qase\PHPUnitReporter\Attributes\Field;
use Qase\PHPUnitReporter\Attributes\Parameter;
use Qase\PHPUnitReporter\Attributes\QaseId;
use Qase\PHPUnitReporter\Attributes\Suite;
use Qase\PHPUnitReporter\Attributes\Title;
use Qase\PHPUnitReporter\Qase;

#[Suite("Main suite")]
class SimplesTest extends TestCase
{
    #[
        Title('Test one'),
        Parameter("param1", "value1"),
    ]
    public function testOne(): void
    {
        Qase::comment("My comment");
        $this->assertTrue(true);
    }

    #[
        QaseId(123),
        Field('description', 'Some description'),
        Field('severity', 'major')
    ]
    public function testTwo(): void
    {
        Qase::attach("/my_path/file.json");
        $this->assertTrue(false);
    }

    #[
        Suite('Suite one'),
        Suite('Suite two')
    ]
    public function testThree(): void
    {
        Qase::attach((object) ['title' => 'attachment.txt', 'content' => 'Some string', 'mime' => 'text/plain']);
        throw new Exception('Some exception');
    }
}

To execute PHPUnit tests and report them to Qase.io, run the command:

QASE_MODE=testops ./vendor/bin/phpunit

or, if configured in a script:

composer test

A test run will be created and accessible at:

https://app.qase.io/run/QASE_PROJECT_CODE

Parallel Execution

The reporter supports parallel execution of tests using the paratest package.

To run tests in parallel, use the following command:

QASE_MODE=testops ./vendor/bin/paratest

Configuration

Qase PHPUnit Reporter can be configured using:

  1. A separate configuration file qase.config.json.
  2. Environment variables (which override the values in the configuration file).

For a full list of configuration options, refer to the Configuration Reference.

Example qase.config.json

{
  "mode": "testops",
  "debug": true,
  "testops": {
    "api": {
      "token": "api_key"
    },
    "project": "project_code",
    "run": {
      "complete": true
    }
  }
}

Requirements

We maintain the reporter on LTS versions of PHP.

  • php >= 8.1
  • phpunit >= 10

统计信息

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

GitHub 信息

  • Stars: 7
  • Watchers: 4
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固