Benchmarks will allow you to assert against a profile of the page under test. You could use this to check if a page is using eager loading correctly or if it has any particularly slow queries. For example,
Because a test does not implicitly begin a benchmark you are free to do your setup first and then begin the benchmark, thus avoiding test preamble affecting your scores.
it('loads an article', function () {
$entry = Entry::factory()->section('articles')->create();
$this->beginBenchmark()
->get($entry->uri)
->endBenchmark()
->assertLoadTimeLessThan(2);
});
Benchmarks will allow you to assert against a profile of the page under test. You could use this to check if a page is using eager loading correctly or if it has any particularly slow queries. For example,
Because a test does not implicitly begin a benchmark you are free to do your setup first and then begin the benchmark, thus avoiding test preamble affecting your scores.