A test asserting an exact query count fails on every unrelated change and is deleted within a month; a bound survives.
public function testProductPageDoesNotNPlusOne(): void
{
$product = $this->productWithVariants(50);
DB::enableQueryLog();
$this->get("/products/{$product->id}")->assertOk();
$this->assertLessThan(12, count(DB::getQueryLog()));
}
// 50 variants: the point is that it is not 52.
The fixture size is the part that makes the assertion meaningful — with three variants an N+1 is under any bound worth setting. The test proves the count does not scale with the data rather than that it is small, which is the property that matters. It is a proxy and not a measurement: replacing four hundred fast queries with two slow ones passes, and that is usually an acceptable trade for a test that keeps working.