Laravel Smoke testing

Smoke tests ensure you that laravel boots correctly and all pages are loaded. You can even check if text in your page matches what are you hope for.

It’s extremely easy to write these tests and when you change something in your code, you know that you don’t leave some dd(), exit or something you use just for debug.

You already have your first smoke test in tests/ExampleTest.php.

     * A basic functional test example.
     * @return void
    public function testBasicExample()
             ->see('Laravel 5');

I am using Laravel Homestead so in my case I need to install PHPUnit first.

sudo composer global require phpunit/phpunit

Then just type in terminal phpunit and you will run your first test. If it is fresh Laravel installation it must pass and you will got green.

Your own smoke tests with Laravel

Now, when you know how it works, you can write your own smoke tests. Just repeat example and test if all your pages opening. Every time you push your application to production you can now be sure, that all pages are working and you don’t screw anything in your code. This is not ensure you from inserts/updates/deletes errors, but it is more safe writing smoke tests versus no tests. Forget to go and click manually on every link in your page and check if it works, just write smoke tests.


You can use spatie/laravel-link-checker to check all your web-app links without writing tests. This package just checks all your links and expects to get HTTP status – 200 which means OK.

Laravel Smoke testing