Giter Site home page Giter Site logo

phpunit-slow-tests's Introduction

Get a better overview of the slowest tests in your suite

Latest Version on Packagist Tests

Installation

You can install the package via composer:

composer require maurobaptista/phpunit-slow-tests --dev

Usage

In your phpunit.xml file, add the extensions as below.

  <extensions>
    <extension class="MauroBaptista\SlowTests\Extensions\ResultToCSV">
      <arguments>
        <string>tests/report/result.csv</string>
      </arguments>
    </extension>
    <extension class="MauroBaptista\SlowTests\Extensions\SlowestTests" />
  </extensions>

Configuration

ResultToCSV Extension

A CSV export of the time of all ran tests will be stored in this file.

<extensions>
    <extension class="MauroBaptista\SlowTests\Extensions\ResultToCSV">
        <arguments>
            <string>tests/report/result.csv</string>
        </arguments>
    </extension>
</extensions>

Arguments:

Argument Type Default Note
file string result.csv Path to the file (can be a relative path)

Output:

Console:

Result to CSV

File:

datetime,class,method,duration
"2022-11-08 02:06:23","Tests\Unit\ExampleTest",that_true_is_true,0.0055065
"2022-11-08 02:06:23","Tests\Feature\ExampleTest",that_true_is_true,0.186276667

SlowestTests

<extensions>
    <extension class="MauroBaptista\SlowTests\Extensions\SlowestTests">
        <arguments>
            <integer>10</integer>
            <array>
                <element key="success">
                    <double>0.1</double>
                </element>
                <element key="warning">
                    <double>1</double>
                </element>
            </array>
        </arguments>
    </extension>
</extensions>

Arguments:

Argument Type Default Note
show integer 10 Amount of tests that will be shown after the test ran
threshold array ['success' => 0.1, 'warning' => 1] Time to show tests as green, yellow, or red (in seconds)

Output:

Console:

Slowest Tests

Testing

composer test

Credits

License

The MIT License (MIT). Please see License File for more information.

phpunit-slow-tests's People

Contributors

mauro-baptista avatar dependabot[bot] avatar github-actions[bot] avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.