Outsource Laravel Development Partner - $3200/Month | Bacancy

A Roundup of Laravel Testing Resources and Packages

Published on by

A Roundup of Laravel Testing Resources and Packages image

Testing code is one of the more challenging parts of programming, but luckily Laravel and some other tools are making it easier than ever. Research has even shown implementing a Test-Driven Development (TDD) approach can significantly reduce the number of bugs that make it to production. Testing provides many other benefits, like the freedom to refactor large parts of a system without (as much) fear of breaking things.

Everybody has a testing environment. Some people are lucky enough enough to have a totally separate environment to run production in.

— Papa Devops (@stahnma) August 21, 2015

With all of the benefits of testing, it’s still challenging to continually test applications. If you are looking to start learning how to test Laravel applications or you want to expand your skills here is a list of great resources to help you:

The Official Documentation

](https://laravel.com/docs/master/testing)

The official Laravel documentation is arguably the most complete testing guide that ships with a PHP framework. Not only does the guide itself make it very easy to start testing Laravel applications, but the framework itself also provides essential tools that take away the excuses of not testing. The most important features to make testing easier—that ship with Laravel—include database migrations for testing, factories, and mocking/fakes.

This first resource is obvious, but those new to Laravel and testing applications, stop by the documentation first. As a companion to the documentation, watch the Laracasts video Laravel From Scratch: Testing 101 for an overview of testing Laravel.

Laravel Dusk

](https://github.com/laravel/dusk)

Laravel Dusk is a browser testing package that works with >= Laravel 5.4. The Dusk documentation is part of the official Laravel documentation, but it’s worth mentioning separately because it is a recent addition to the Laravel testing tools. Dusk doesn’t require Selenium but uses the standalone ChromeDriver—which ships with the package.

Dusk allows you to test dynamic JavaScript applications with convenient browser abstractions and PHPUnit assertions. Before Laravel 5.4 full browser testing automation wasn’t possible without third party packages. This is another example of the Laravel framework facilitating testing and making it convenient for developers to get started.

The Orchestral Testbench Component

](https://github.com/orchestral/testbench)

The Orchestral Testbench package is a testing helper for Laravel package development. According to the readme file, the Orchestral Testbench package:

…is a simple package that has been designed to help you write tests for your Laravel package, especially when there is routing involved.

The Laracasts Laravel Behat Extension

](https://github.com/laracasts/Behat-Laravel-Extension)

Behat is the defacto tool for Behavior-Driven Development (BDD) in the PHP community, and this package can help you get started with Behat and Laravel quickly. Before Laravel Dusk was available, full browser testing automation was only possible with third party packages and tools.

Although Dusk is now available, Behat might be a tool you prefer for acceptance testing if you prefer the BDD flavor of testing with Cucumber. Laracasts provides a lesson on using Behat,Laravel 5 and Behat: BFFs, which will help you get started with Behat 3 and Laravel 5.

phpspec

](http://www.phpspec.net/en/stable/)

phpspec is a tool for writing BDD Specifications in PHP. The interesting thing about phpspec is how it guides you through small steps in writing test specifications, then making them pass. Learning phpspec can open your mind to a new way of testing.

You can learn how to get started with the phpspec manual. Laracasts has an introduction video to compliment the documentation. phpspec is a great tool for testing any PHP project, including Laravel packages.

phpspec Laravel Extension

](https://github.com/BenConstable/phpspec-laravel)

phpspec Laravel Extension helps you test Laravel applications with phpspec:

This extension provides you with a bootstrapped Laravel environment when writing your phpspec tests.

Learning phpspec is a prerequisite for using this package.

Let’s Build a Forum with Laravel and TDD

](https://laracasts.com/series/lets-build-a-forum-with-laravel)

The Build a Forum with Laravel and TDD series is only available to subscribers, but a the time of this writing there are 58 lessons on building a forum with Laravel and Test-Driven Development. This is one of the most complete tutorials on testing with Laravel and TDD. Even if you exhaust the generous number of free resources first, this is a great way to learn more about TDD with Laravel.

Test-Driven Laravel

](https://adamwathan.me/test-driven-laravel/)

Test-Driven Laravel is a video series by Adam Wathan which provides a thorough look into testing Laravel applications. This course is not free, but as of this writing, you could still get early access. The course has many hours of courses with more still being added.

Adam Wathan initially gave a presentation on Test-Driven Laravel at ZendCon and then condensed his talk into a screencast you can watch online. We’ve also reviewed this course on Laravel News.

Spatie Laravel Packages

](https://github.com/spatie?utf8=%E2%9C%93&q=laravel&type=source&language=php)

Spatie provides many Laravel packages, and they continue to ship new packages to the community. The packages contain a wealth of testing source code and are a good reference to help you learn how to test Laravel packages. Some packages have a dependency on the aforementioned Orchestral Testbench, providing you with some examples of using Testbench in action.

Spatie packages also have Continuous Integration with Travis CI (laravel-backup example). The murze.be blog provides Laravel tips and tricks on package development and new package announcements being released by Spatie.

The Ruby on Rails Tutorial Book

](https://www.railstutorial.org/book)

This resource is a bit of a wildcard. While not PHP or Laravel related, this free online book is chock-full of real-world testing examples you can apply to your projects. It starts picking up testing features in Chapter 3.3.

Even if you don’t care about Ruby or Rails, you will be hard-pressed to find better testing material on how to write web application tests, including the theory behind what to test and how to test it. You can follow along or just read through the material to get some great testing insight and inspiration.

Test Driven Development: By Example

](http://amzn.to/2t07vON)

Test Driven Development: By Example is considered by many a classic text on TDD. While the examples are not written in PHP, the book covers an expansive list of TDD patterns and practices and will provide beginners a good background on TDD with some practical examples.

Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

image
Battle Ready Laravel

The ultimate guide to auditing, testing, fixing and improving your Laravel applications so you can build better apps faster and with more confidence.

Visit Battle Ready Laravel
Curotec logo

Curotec

World class Laravel experts with GenAI dev skills. LATAM-based, embedded engineers that ship fast, communicate clearly, and elevate your product. No bloat, no BS.

Curotec
Bacancy logo

Bacancy

Supercharge your project with a seasoned Laravel developer with 4-6 years of experience for just $3200/month. Get 160 hours of dedicated expertise & a risk-free 15-day trial. Schedule a call now!

Bacancy
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
Cut PHP Code Review Time & Bugs into Half with CodeRabbit logo

Cut PHP Code Review Time & Bugs into Half with CodeRabbit

CodeRabbit is an AI-powered code review tool that specializes in PHP and Laravel, running PHPStan and offering automated PR analysis, security checks, and custom review features while remaining free for open-source projects.

Cut PHP Code Review Time & Bugs into Half with CodeRabbit
Get expert guidance in a few days with a Laravel code review logo

Get expert guidance in a few days with a Laravel code review

Expert code review! Get clear, practical feedback from two Laravel devs with 10+ years of experience helping teams build better apps.

Get expert guidance in a few days with a Laravel code review
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
Lunar: Laravel E-Commerce logo

Lunar: Laravel E-Commerce

E-Commerce for Laravel. An open-source package that brings the power of modern headless e-commerce functionality to Laravel.

Lunar: Laravel E-Commerce
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit

The latest

View all →
Laravel 12.44 Adds HTTP Client afterResponse() Callbacks image

Laravel 12.44 Adds HTTP Client afterResponse() Callbacks

Read article
Handle Nested Data Structures in PHP with the Data Block Package image

Handle Nested Data Structures in PHP with the Data Block Package

Read article
Detect and Clean Up Unchanged Vendor Files with Laravel Vendor Cleanup image

Detect and Clean Up Unchanged Vendor Files with Laravel Vendor Cleanup

Read article
Seamless PropelAuth Integration in Laravel with Earhart image

Seamless PropelAuth Integration in Laravel with Earhart

Read article
Laravel API Route image

Laravel API Route

Read article
Laravel News 2025 Recap image

Laravel News 2025 Recap

Read article