22. Running tests in parallel


Let's take a quick break to see how we can run our tests in parallel with PEST. Now within Laravel this feature has been available for a little while
and if we check this out you can see that we can use this parallel option when we run phps and test. Now we're running PEST so let's try this out and see what happens. So let's run PEST and parallel and you can see here parallel support requires the parallel plugin.
So we're going to go ahead and pull this in and see how it's going to speed up our tests. Now our tests are pretty quick at the moment but of course we can always benefit from getting faster feedback so as our test numbers grow and we do more this is going to really help us. So let's come down and install this and then we'll check out how it works.
Okay so that's pretty much pulled in and we can go ahead and follow the instructions here. So we can either use the parallel option or just P on its own which of course is shorter. So let's run PEST and P and there we go. So that's not much difference at the moment from what we would normally get
but as our tests grow you'll see a massive reduction in the speed at which this works. Now what we can also do is specify the processes here. So if you wanted to go ahead and run P with the processes option you can bump this up to as many processes as you need.
Once again in our case we don't really have that many tests so we're not seeing a massive reduction in time. But in future you can just go ahead and run PEST P just to make sure you're getting the fastest test run you can.
35 episodes4 hrs 19 mins


Pest is a PHP testing framework that brings beautifully simple syntax to your tests, without sacrificing on features. In this course, we'll get up and running with Pest in a Laravel project and write tests for a real-world application that we'll build along the way.

You'll learn how to set Pest up in a Laravel project, write tests with Pest's built-in assertions, generate code coverage, and more.

Alex Garrett-Smith
Alex Garrett-Smith
Hey, I'm the founder of Codecourse!


No comments, yet. Be the first to leave a comment.