Qase-phpunit - Qase TMS PHPUnit reporter.

Overview

Qase TMS PHPUnit reporter

Publish results simple and easy.

How to integrate

composer require qase/phpunit-reporter

Example of usage

The PHPUnit reporter has the ability to auto-generate test cases and suites from your test data.

But if necessary, you can independently register the ID of already existing test cases from TMS before the executing tests. For example:

/**
 * @qaseId 3
 */
public function testCanBeUsedAsString(): void
{
    $this->assertEquals(
        '[email protected]',
        Email::fromString('[email protected]')
    );
}

You should also have an active item in the project settings at

https://app.qase.io/project/QASE_PROJECT_CODE/settings/options

options in the Test Runs block:

Auto create test cases

and

Allow submitting results in bulk

To run tests and create a test run, execute the command:

$ ./vendor/bin/phpunit

Output of run

A test run will be performed and available at:

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

Using parameterization

PHPUnit reporter also allows you to perform parameterization of the test case. To do this, you need to specify a dataprovider. Example:

    /**
     * @dataProvider additionProvider
     */
    public function testUsingProvider($a, $b, $expected)
    {
        $this->assertSame($expected, $a + $b);
    }

    public function additionProvider()
    {
        return [
            [0, 0, 0],
            [0, 1, 1],
            [1, 0, 1],
            [1, 1, 3]
        ];
    }

dashboard

Configuration

Add to your phpunit.xml extension:

<extensions>
  <extension class="Qase\PHPUnit\Reporter"/>
</extensions>

Reporter options (* - required):

  • QASE_REPORT - toggles sending reports to Qase.io, set 1 to enable
  • *QASE_API_TOKEN - access token, you can find more information here.
  • *QASE_PROJECT_CODE - code of your project (can be extracted from main page of your project, as example, for https://app.qase.io/project/DEMO -> DEMO is project code here.
  • QASE_API_BASE_URL - URL endpoint API from Qase TMS, default is https://api.qase.io/v1.
  • QASE_RUN_ID - allows you to use an existing test run instead of creating new.
  • QASE_RUN_COMPLETE - performs the "complete" function after passing the test run.

The configuration file should be called phpunit.xml, an example of such a file:

<?xml version="1.0" encoding="UTF-8"?>
<phpunit>
  <extensions>
    <extension class="Qase\PHPUnit\Reporter"/>
  </extensions>
  <testsuites>
    <testsuite name="qase-phpunit">
      <directory>./tests</directory>
    </testsuite>
  </testsuites>
  <php>
    <env name="QASE_REPORT" value="1"/>
    <env name="QASE_PROJECT_CODE" value="project_code"/>
    <env name="QASE_API_BASE_URL" value="https://api.qase.io/v1"/>
    <env name="QASE_API_TOKEN" value="api_key"/>
    <env name="QASE_RUN_COMPLETE" value="1"/>
    <env name="QASE_RUN_ID"/>
  </php>
</phpunit>
Comments
  • Utils v2.0.0 support

    Utils v2.0.0 support

    This PR contains qase/php-client-utils update to v2.0.0. It resolves the following Issues:

    • [ ] qase-tms/qase-phpunit#32
    • [ ] qase-tms/qase-phpunit#33
    • [ ] qase-tms/qase-phpunit#34 (the above issues have been resolved in Utils)
    opened by in4s 1
  • #28 step 1 logging/debug option added

    #28 step 1 logging/debug option added

    How to test:

    git clone https://github.com/in4s/qase-phpunit.git
    cd qase-phpunit/example
    git checkout logging_debug_option_support
    composer install --prefer-dist
    

    Then make changes to the config file: examples/phpunit.xml And run tests: php vendor/bin/phpunit

    I guess it needs to be tested only three things:

    1. Config with <env name="QASE_LOGGING" value="1"/>
    2. Config with <env name="QASE_LOGGING" value="0"/>
    3. Config without <env name="QASE_LOGGING" value="1"/> line

    Variants 1 and 3 should show the reporter log in console, as usual. 2nd variant should not show the reporter log. But all three variants should send data to Qase.

    opened by in4s 1
  • Add support logging/debug option

    Add support logging/debug option

    opened by 1ivliev 1
  • Add support for auto create defect

    Add support for auto create defect

    Needs adding support to auto create defects when a test fails by setting defect to true in Qase test results.

    Addition information: https://developers.qase.io/reference/create-result-bulk Field defect (type boolean)

    Example feature in JS -> https://github.com/qase-tms/qase-javascript/pull/248

    AC:

    • update readme
    • create unit tests
    opened by 1ivliev 1
  • Issue with arg QASE_RUN_COMPLETE

    Issue with arg QASE_RUN_COMPLETE

    If you use a new test run and set QASE_RUN_COMPLETE=0 (or skip entering this parameter), the run will still close, but if you put it into a previously created one, then the option works correctly. We need to separate the application of this argument. If you specify type = 0, the run should not be closed.

    bug 
    opened by 1ivliev 0
  • Add support for create custom run name

    Add support for create custom run name

    Must be transmitted through a variable - QASE_RUN_NAME. In case of absence, print a standard inscription. Need to update the documentation with examples, add unit tests.

    opened by 1ivliev 0
  • Add support for custom run description

    Add support for custom run description

    Must be transmitted through a variable - QASE_RUN_DESCRIPTION. In case of absence, print a standard inscription - PHPUnit automated run. Need to update the documentation with examples, add unit tests.

    opened by 1ivliev 0
Owner
Qase TMS
Test case management software for Dev and QA teams
Qase TMS
Mockery - Designed as a drop in alternative to PHPUnit's phpunit-mock-objects library

Mockery Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its c

Mockery 10.3k Jan 1, 2023
The most powerful and flexible mocking framework for PHPUnit / Codeception.

AspectMock AspectMock is not an ordinary PHP mocking framework. With the power of Aspect Oriented programming and the awesome Go-AOP library, AspectMo

Codeception Testing Framework 777 Dec 12, 2022
:computer: Parallel testing for PHPUnit

ParaTest The objective of ParaTest is to support parallel testing in PHPUnit. Provided you have well-written PHPUnit tests, you can drop paratest in y

null 2k Dec 31, 2022
vfsStream is a stream wrapper for a virtual file system that may be helpful in unit tests to mock the real file system. It can be used with any unit test framework, like PHPUnit or SimpleTest.

vfsStream vfsStream is a stream wrapper for a virtual file system that may be helpful in unit tests to mock the real file system. It can be used with

null 1.4k Dec 23, 2022
Rector upgrades rules for PHPUnit

Rector Rules for PHPUnit See available PHPUnit rules Install composer require rector/rector-phpunit Use Sets To add a set to your config, use Rector\P

RectorPHP 34 Dec 27, 2022
Add mocking capabilities to Pest or PHPUnit

This repository contains the Pest Plugin Mock. The Mocking API can be used in regular PHPUnit projects. For that, you just have to run the following c

PEST 16 Dec 3, 2022
A sample RESTful API in Laravel with PHPunit test.

Laravel PHP Framework URL | URI | Action |

Fasil 9 Jul 11, 2020
PHPUnit Application Architecture Test

PHPUnit Application Architecture Test Idea: write architecture tests as well as feature and unit tests Installation Install via composer composer requ

null 19 Dec 11, 2022
PHPUnit to Pest Converter

PestConverter PestConverter is a PHP library for converting PHPUnit tests to Pest tests. Before use Before using this converter, make sure your files

null 10 Nov 21, 2022
Allows the running of PHPUnit within ExpressionEngine

EE Unit Tests EE Unit Tests is an Add-on for ExpressionEngine that allows developers to execute unit tests from the Command Line. EE Unit Tests uses P

Eric Lamb 6 Jan 14, 2022
PHP libraries that makes Selenium WebDriver + PHPUnit functional testing easy and robust

Steward: easy and robust testing with Selenium WebDriver + PHPUnit Steward is a set of libraries made to simplify writing and running robust functiona

LMC s.r.o. 219 Dec 17, 2022
PHPUnit extension for database interaction testing.

This extension is no longer maintained DbUnit PHPUnit extension for database interaction testing. Installation Composer If you use Composer to manage

Sebastian Bergmann 224 Aug 20, 2022
Mock implementation of the Translation package, for testing with PHPUnit

PoP Translation - Mock Mock implementation of the Translation package, for testing with PHPUnit Install Via Composer composer require getpop/translati

PoP 1 Jan 13, 2022
Magento PHPUnit Integration

Magento PHPUnit Integration Magento is a quite complex platform without built in unit test suite, so the code is not oriented on running tests over it

EcomDev B.V. 303 Dec 18, 2022
The objective of ParaTest is to support parallel testing in PHPUnit

The objective of ParaTest is to support parallel testing in PHPUnit. Provided you have well-written PHPUnit tests, you can drop paratest in your project and start using it with no additional bootstrap or configurations!

null 2k Dec 31, 2022
Report high memory usage PHPUnit tests: Managed by opg-org-infra & Terraform

phpunit-memory-usage Report high memory usage PHPUnit tests: Managed by opg-org-infra & Terraform Configuration Add into the phpunit.xml extensions se

Ministry of Justice 2 Aug 4, 2022
PHPStan PHPUnit extensions and rules

PHPStan PHPUnit extensions and rules PHPStan PHPUnit This extension provides following features: createMock(), getMockForAbstractClass() and getMockFr

PHPStan 359 Dec 28, 2022
Satisfy the Type APIs for the WordPress schema when running PHPUnit tests

Satisfy the Type APIs for the WordPress schema when running PHPUnit tests

GraphQL API 1 Apr 12, 2022