Shift with red gradient lettering

Laravel Tests Generator

The Tests Generator automates the process of generating tests for your existing Laravel application. By default, the Tests Generator creates tests using the PHPUnit testing framework. However, if Shift detects a dependency for pestphp/pest, it will create tests using the Pest testing framework.

While you could use artisan make to do this yourself, this can be a time consuming process. In addition, this command only generate a stub. Shift performs analysis on your application code to intelligently generate model factories, HTTP tests, and real test cases.

Requirements

  • A Laravel application running Laravel 6.0 or higher.
  • Must be able to run composer install from remote server.
  • Must be able to run artisan route:list without error.
  • Application must be free of PHP errors.

Test Generation

The Tests Generator automates the following testing components:

  • Verifies the default Laravel testing files are up-to-date.
  • Writes the factories for testing your application Models.
  • Generates HTTP Tests for your application Controllers complete with request setup.
  • Stubs Console Tests for your application commands.
  • Adds assertions for Form Requests to verify validation used within your application.
  • Configures a basic testing environment.
  • Installs helpful testing packages to generate and test additional components.

Manual Changes

While the Tests Generator attempts to generate the components above there may be cases where Shift is unable to build your application. In these cases, Shift will leave a comment on the PR with steps for generating the component manually.

Still have questions? Message @laravelshift on Twitter or email support@laravelshift.com.

Sign in with any of the following services to connect Shift with your Laravel project.


Don't use one of these services?

Temporarily push your project to a free, private repository on one of these cloud-based services or upgrade your project locally with Shift for Docker.