Skip to main content

What is Testbench Workbench?

Orchestra Testbench is focused on automated tests. With Workbench, you also get a small Laravel app inside your package repository for interactive development. Use it as a continuation of package-testing when you need UI checks, route verification, and seeded integration scenarios.

Setup

1

Install Testbench

2

Install Workbench scaffold

This command does the following in one step:
  • Creates the workbench/ directory structure
  • Adds Workbench namespaces to composer.json autoload-dev
  • Adds build scripts to composer.json scripts
Additional options:
  • --force: overwrite existing files
  • --basic: minimal setup without routes and package discovery configuration
  • --devtool: enable DevTool support
3

Build and serve

workbench:install prepares the workbench/ tree, autoload-dev, and related scripts in one step.
After installation, composer.json includes the following:

Define your environment in testbench.yaml

Use testbench.yaml in the package root to control providers, migrations, and build steps.
testbench.yaml often contains environment-specific settings. Add it to .gitignore and keep a testbench.yaml.example template in the repository for other developers.
Key configuration options: You can also set environment variables in testbench.yaml:

Workbench directory structure

workbench
app
Models
bootstrap
config
database
factories
migrations
public
storage

Core features Workbench gives you

WorkbenchServiceProvider

Create a service provider to register Workbench-specific services and wire up demo routes and views.

Routes and controllers

Place development routes in workbench/routes/web.php and workbench/routes/api.php so you can verify package behavior from a browser or HTTP client.

Migrations and seeders

Use workbench/database/migrations and workbench/database/seeders to test your package against realistic schema and data.
Populate test data with a seeder:

Local runtime and console workflows

Run Artisan commands through vendor/bin/testbench.

Testing with the WithWorkbench trait

Use the WithWorkbench trait to apply testbench.yaml configuration to your automated test suite.

Combine Workbench with automated tests

Use Workbench for interactive checks and keep your tests/ directory for repeatable automated assertions.
  • Automation: regression safety in tests/
  • Interactive verification: end-to-end behavior in workbench/

Troubleshooting

Check testbench.yaml syntax and provider configuration. YAML indentation errors are a common cause.
Verify the route file paths and the WorkbenchServiceProvider registration. Confirm that discovers.web is set to true in testbench.yaml.
Check that migration paths are correct. When using SQLite, make sure the create-sqlite-db build step is included.

Testing Laravel packages with Orchestra Testbench

Start with the package testing foundation first.

Package version compatibility management

Learn version mapping and CI matrix strategy for Laravel and Testbench.
Last modified on April 26, 2026