spatie/pest-plugin-route-testing
Pest plugin for Laravel that automatically tests all your app’s GET routes. Run a single test to assert responses are successful, redirects, forbidden, not found, etc. Filter routes by pattern and provide models for route model bindings via bind().
GET routes in a Laravel application, reducing the risk of broken or unreachable endpoints. This aligns with initiatives to improve test coverage, especially for APIs or public-facing routes./login, /dashboard) are accessible and return expected status codes, supporting compliance with security audits or feature parity requirements.POST, PUT, etc., via custom assertions.Adopt when:
Look elsewhere if:
/users/{user:uuid}) and you lack mock data for testing. The package skips these by default.POST, DELETE) extensively. This package focuses on GET by default (though assertions like assertForbidden() can be used)."This package automates the validation of every public route in our Laravel app, ensuring users can always access critical pages—like checkout, login, or dashboards—without manual QA overhead. For a minimal investment (MIT-licensed, open-source), it reduces post-launch bugs and aligns with our CI/CD goals. Think of it as ‘smoke testing for routes’: fast, reliable, and scalable as we add features. It’s especially valuable for our [API/SaaS/product] where uptime directly impacts revenue."
Key Outcomes:
"This Pest plugin lets us test all GET routes in one command, saving hours of manual work. For example:
routeTesting('All public routes')
->assertSuccessful(); // Fails if any route returns 4xx/5xx
It skips model-bound routes (e.g., /users/{id}) by default but supports binding models if needed. Perfect for:
Downside: Doesn’t test POST/PUT routes or auth middleware by default, but we can extend it. Worth trying for route stability gains."
Tech Highlights:
->include('admin*')) or use any TestResponse assertion.How can I help you explore Laravel packages today?