Download the PHP package nexusphp/tachycardia without Composer
On this page you can find all versions of the php package nexusphp/tachycardia. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nexusphp/tachycardia
More information about nexusphp/tachycardia
Files in nexusphp/tachycardia
Package tachycardia
Short Description Detects slow running tests in your PHPUnit-driven test suites.
License MIT
Informations about the package tachycardia
Nexus Tachycardia
Tachycardia is a PHPUnit extension that detects and reports slow running tests and prints them right in your console. It can also optionally inline annotate the specific tests in the files during pull requests.
NOTE: Tachycardia will only detect the slow tests in your test suites but will offer no explanation as to why these identified are slow. You should use a dedicated profiler for these instead.
Installation
Tachycardia should only be installed as a development-time dependency to aid in running your project's test suite. You can install using Composer:
composer require --dev nexusphp/tachycardia
Configuration
Tachycardia supports these parameters:
- time-limit - Time limit in seconds to be enforced for all tests. All tests exceeding this amount will be considered as slow. Default: 1.00
- report-count - Number of slow tests to be displayed in the console report. This is ignored on Github Actions report. Default: 10
- precision - Degree of precision of the decimals of the test's consumed time and allotted time limit. Default: 4
- format - The format of the renderer for the console.
- ci-format - The format of the renderer for the CI.
Renderer formats for both the console and CI could be any of:
Format | For Console? | For CI? | Remarks |
---|---|---|---|
list | ✅︎ | ❌ | Default for console |
table | ✅︎ | ❌ | |
github | ✅︎ | ✅︎ | Default for CI |
gitlab | ✅︎ | ✅︎ | |
teamcity | ✅︎ | ✅︎ |
To use the extension with its default configuration options, you can simply add the following
into your phpunit.xml.dist
or phpunit.xml
file.
Now, run vendor/bin/phpunit
. If there are test cases where the time consumed exceeds the configured
time limits, these will be displayed in the console after all tests have completed.
If you wish to customize one or more of the available options, you can just change the entry in your
phpunit.xml.dist
or phpunit.xml
file.
Documentation
- Reporting Slow Tests
- Enable/disable console reporting using environment variable
- Enable/disable profiling in Github Actions
- Custom Time Limits
- Setting custom time limits per test
- Setting custom time limits per class
- Disabling time limits per test or per class
- Using Attributes instead
- Tabulating results instead of plain render
- Rerunning slow tests to see if these are fast now
Upgrading
Upgrading from v1.x to v2.x? See the UPGRADING Guide.
Contributing
Contributions are very much welcome. If you see an improvement or bug fix, open a PR now!
Read more on the Contributing to Nexus Tachycardia.
Inspiration
Tachycardia was inspired from johnkary/phpunit-speedtrap
,
but injected with anabolic steroids.
Tachycardia is actually a medical term referring to a heart rate that exceeds the normal resting rate in general of over 100 beats per minute.
License
This library is licensed under the MIT License.