testo/repeat
Testo repeat policy plugin. Re-runs a test multiple times in a single run to surface flaky behavior, catch intermittent regressions, and verify consistent results. Opt-in per test or per test class and works alongside other Testo plugins.
createApplication(), actingAs()) may require adaptation if used within repeated tests, as the plugin does not natively support Laravel-specific features.testo/repeat).@repeat annotations or test-class-level policies).testo.php. Example:
// testo.php
'plugins' => [
'repeat' => [
'default_repeats' => 3,
'max_failures' => 0, // Fail if any repeat fails
],
];
@dataProvider).0.1.5, the package is early-stage. Risks include:
RefreshDatabase, RefreshMigrations).Framework Strategy:
Use Case Validation:
maxFailures be tuned to balance sensitivity and noise? (e.g., 0 for strict, 1 for lenient)Performance and CI Impact:
Failure Handling:
Long-Term Viability:
@repeat)@repeat, custom Composer scripts) that could be explored?Testing Strategy:
createApplication(), actingAs()) may need adaptation for repeated tests.RefreshDatabase, ensure the plugin doesn’t leak state between repeats (e.g., transactions, migrations).Assess Testo Adoption:
@test → test()), assertions, and plugins.@dataProvider, uses()).Plugin Installation:
composer require --dev testo/repeat
testo.php:
'plugins' => [
'repeat' => [
'default_repeats' => 3, // Run each test 3 times
'max_failures' => 0, // Fail if any repeat fails
],
];
Incremental Rollout:
@repeat to high-flakiness tests (e.g., API calls, external services).
use Testo\Repeat\Repeat;
#[Repeat(3)]
test('payment processing is idempotent', function () {
// Test logic
});
CI Integration:
composer.json:
"scripts": {
"test": "testo",
"test:ci": "testo --filter=\"@repeat\""
}
testo/assert, testo/mock), but interaction testing is recommended.RefreshDatabase or RefreshMigrations resets state between repeats.Http::fake(), verify repeat isolation.Proof of Concept (PoC):
@repeat to validate:
@runInSeparateProcess).Plugin Configuration:
testo.php (e.g., default_repeats: 3).max_failures based on CI tolerance (e.g., 0 for strict, `1How can I help you explore Laravel packages today?