nexusphp / tachycardia Goto Github PK
View Code? Open in Web Editor NEW:runner: Detects slow running tests in your PHPUnit-driven test suites.
License: MIT License
:runner: Detects slow running tests in your PHPUnit-driven test suites.
License: MIT License
Is your feature request related to a problem? Please describe.
Update extension to PHPUnit 10.
Describe the solution you'd like
Update internals to use PHPUnit 10's new Event System.
Please consider per-test annotations to disable speed reporting. See for example: johnkary/phpunit-speedtrap#84
Environment:
Description:
When enabled, Tachycardia doesn't render the correct line numbers of the slow tests when annotated in Github Actions.
Expected Output:
Correct line numbers will be displayed.
Environment:
v1.1.1
Description:
When using the @timeLimit
annotation on a test with a data provider the new limit is not respected.
Steps to Reproduce:
Here's my actual test case (using ControllerTester
):
/**
* @dataProvider indexDataProvider
* @timeLimit 0.75
*/
public function testIndexHasCorrectJobs(string $method, array $expected)
{
$result = $this->execute($method);
$result->assertOK();
$result->assertStatus(200);
// Check that each expected Job is present and others are not
foreach (['staff', 'client', 'completed', 'deleted'] as $type)
{
if (in_array($type, $expected))
{
// Check for the Job name linked by its ID
$result->see(anchor('jobs/show/' . $this->$type->id, $this->$type->name));
}
else
{
$result->dontSee($this->$type->name);
}
}
}
public function indexDataProvider(): array
{
return [
['staff', ['staff']],
['active', ['staff', 'client']],
['archive', ['completed']],
['all', ['staff', 'client', 'completed']],
['trash', ['deleted']],
];
}
No matter what I set for @timeLimit
I always get a warning:
Nexus\PHPUnit\Extension\Tachycardia identified this sole slow test:
+--------------------------------------------------------------+---------------+-------------+
| Test Case | Time Consumed | Time Limit |
+--------------------------------------------------------------+---------------+-------------+
| JobsControllerTest::testIndexHasCorrectJobs with data set #2 | 00:00:00.68 | 00:00:00.50 |
+--------------------------------------------------------------+---------------+-------------+
Notice that "Time Limit" is 0.5
.
Expected Output:
Each iteration of a data-provided test should use the limit override.
Environment:
Description:
I'm not entirely sure if this is a bug but I did not notice this issue with SpeedTrap. It appears that the time to run setUp()
is included in the test time limit - this is particularly confusing for once-run database configurations with data providers where a single data set will show as a lot slower than the others. I have tested without data providers as well to confirm it is not a fringe scenario.
Steps to Reproduce:
See e.g. https://github.com/duke-bluesmith/bluesmith/blob/develop/tests/controllers/JobsControllerTest.php, and the various test results at #7
Expected Output:
I think the ideal scenario would be to split out the "staging" from the actual tests, and be able to report on slow staging (e.g. setUp
and tearDown
) with their own annotated @timeLimit
options. Barring the difficulty of that implementation, I would like to see time limits calculated solely on my actual test methods.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.