Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Pest Plugin Route Testing Laravel Package

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().

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Quality Assurance & Test Coverage: Automatically validate all 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.
  • Developer Productivity: Eliminates manual route testing, saving QA and engineering time. Ideal for teams adopting CI/CD pipelines where automated checks are critical.
  • Security & Compliance: Ensures critical routes (e.g., /login, /dashboard) are accessible and return expected status codes, supporting compliance with security audits or feature parity requirements.
  • Roadmap for API-First Products: Useful for teams building APIs or headless applications where route stability is paramount. Can be extended to include POST, PUT, etc., via custom assertions.
  • Build vs. Buy: A lightweight, open-source alternative to commercial testing tools (e.g., Postman, SoapUI) for Laravel-specific needs. Low maintenance overhead compared to building custom solutions.
  • Onboarding & Documentation: Helps onboard new developers by providing a clear, automated way to validate the application’s route structure, reducing "works on my machine" issues.

When to Consider This Package

  • Adopt when:

    • Your Laravel app has 50+ routes and manual testing is error-prone or time-consuming.
    • You prioritize automated regression testing for routes (e.g., post-deployment or pre-release).
    • Your team lacks dedicated QA resources but needs to ensure route reliability.
    • You’re building a public API, SaaS product, or multi-tenant app where route availability is critical.
    • You want to integrate route testing into CI pipelines (e.g., GitHub Actions) for early bug detection.
  • Look elsewhere if:

    • Your app relies heavily on dynamic route model bindings (e.g., /users/{user:uuid}) and you lack mock data for testing. The package skips these by default.
    • You need to test non-GET routes (e.g., POST, DELETE) extensively. This package focuses on GET by default (though assertions like assertForbidden() can be used).
    • Your team prefers behavior-driven testing (e.g., testing route logic rather than just HTTP statuses). Tools like Pest or Laravel’s built-in testing may suffice.
    • You’re using Laravel Octane or real-time route validation (e.g., Pusher, WebSockets), which this package doesn’t support.
    • Your routes require authentication/middleware that isn’t easily mockable. The package doesn’t handle auth by default (though you could extend it).

How to Pitch It (Stakeholders)

For Executives/Product Leaders:

"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:

  • Faster releases: Catch broken routes early in CI.
  • Higher quality: Reduce "oops, this page is down" incidents.
  • Cost-effective: No licensing fees; integrates with existing Pest tests.

For Engineering Teams:

"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:

  • Pre-deployment checks: Add to your CI pipeline.
  • Onboarding: New devs can run this to verify the app’s route structure.
  • Refactoring: Safely modify routes knowing we’re not breaking existing endpoints.

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:

  • Zero setup: Works with existing Pest tests.
  • Customizable: Filter routes (e.g., ->include('admin*')) or use any TestResponse assertion.
  • Clear output: Fails fast with screenshots of broken routes (see example).
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport