Building a PHPUnit to Pest Converter in a week

Main Thread 5 min read

During the last week of August I had the idea to live stream each day. The goal was to build a Shift from start to finish. In this case, a PHPUnit to Pest Converter.

This was mostly to work in public. It wasn't just me. Jess Archer joined for some pairing sessions, and the audience itself helped at times through the chat.

We started on Monday and the following Monday I launched a beta version of the Pest Converter. Since launch, it's been run 37 times generating $411.

This turned out being more successful than I thought. By a few measures. So I wanted to write up a retro on the motivation and execution around building this Shift in a week.

Why build a Shift in a week?

The truth, I had the availability. Normally during this time of year I would be building the a Shift for the latest Laravel release. However, this year Laravel changed the release cycle and moved it back. At this point there will not be a release in 2021. So I've had extra time to work on various things, like the Tailwind Shifts and Workbench.

Another reason was the social aspect. Normally I go to multiple conferences a year. Either as a speaker or as an attendee. The last conference I went to was in February 2020. So while live streaming isn't necessarily the same as an in-person conference, it's the only option I have to interact with others devs in real-time. Not many attend my live streams, but I did notice an uptick for these. This came from hype on Twitter by Pest's creator (Nuno Maduro) and aggregation from LaraStreamers.

Finally it's an asset. Yet another SKU in the catalog of Shifts. The number of runs since launching may not sound like much. But consider the lifetime potential. Money was not the primary motivation. It was last. All the same consider the ROI. I spent about 5 hours streaming and maybe double that off-stream and pushing past the MVP. That gives me a rate of $30/hour. Which is 4x the minimum wage in the United States. That's all the time investment I'll have for a while. It will only improve from here.

Why Pest?

The hype. Not only has Pest received more buzz on Twitter lately, but I've had multiple devs ask about automating the conversion of PHPUnit tests to Pest. While building a product off the requests of a few is not a very probable business strategy, I was also interested in Pest personally. I've always enjoyed the spec-based syntax and found it cleaner. With an automated way to convert my existing PHPUnit test suites, I'd be more likely to adopt Pest myself.

I've been interested in Pest from the very beginning. In fact, several years ago I built PSpec. I abandon it once I found Pho. And I abandon that due to some of its limitations with closures at the time (PHP 5). With modern PHP, I'm excited to revisit this with Nuno's fresh take.

Beyond the hype, there is real growth potential. Sure, it's a gamble. But as noted above, my time investment is small. It's pretty likely I'll make that back. So if Pest were to become a popular testing framework within PHP, the market would be massive. Even if it were just more popular within the Laravel community, that's still quite a large market. I think Pest's growth within the Laravel community is pretty likely. There was already a PR to make Pest the default testing framework for Laravel. I wouldn't be surprised to see this for Laravel 9 or Laravel 10. Who knows, the Pest Converter might even help growth. So it's positioned for success.

How did I build a product in a week?

Being able to build and launch this in a week is a testament to Shift's foundation. After nearly 6 years of crafting the automation of over 50,000 applications, it's pretty robust. That's not to say you couldn't build this from scratch in a week. But you definitely would've spent more than 15 hours.

I also think I have the ability to stay focused on a core problem. Developers have a tendency to get sniped by the new shiny or lost in all of the edge cases. You could see this over and over again in the chat. Better ways for me to write the code or additional features for the Pest Converter. These were all good ideas, just not for the MVP.

Being able to stay focused on the simplest thing is hard. In this case, the simplest thing to do was to convert PHPUnit test methods to Pest test functions, and remove any PHPUnit test class skeleton. That was the bare minimum. That's what I focused on. Being able to stay focused like that doesn't mean you get something done faster. It doesn't even mean it's better. It just means you get something done. In the product world, that is what matters.

An MVP is also about identifying an achievable solution. Not the solution. You couldn't build Uber in a week. But you might be able to organize a few carpool group texts. Being able to take a problem and find a path to start solving the problem within a timeframe is what drives an MVP. Converting the syntax of existing tests code was an achievable problem within a week. Once that was complete, I can iterate and make improvements.


The future will tell if Pest grows into the hype. The takeaways from this article are more about the decisions and execution for building an MVP - the ability to honor a time constraint and use it to guide a simple, yet complete, solution.

In closing, I want thank Jess for pairing with me to build the Pest Converter. Nuno for answering my questions on idiomatic ways to write Pest tests. Luke Downing and Freek Van der Herten for allowing me to test this on some of their applications. And finally to all those who viewed the live streams and conversations on Twitter. Thank you.

Want to see all the live streams? Review this Twitter thread for a short description and link for each recording.

Want to convert your PHPUnit test suite to Pest? Use the Pest Converter to automatically convert your test cases and adopt the expectations API in seconds.