testing-strategies

Guide writing unit, feature, component, and E2E tests for Laravel and React.

Updated Feb 8, 2026
One-click install
npx skills add https://github.com/bramato/laravel-react-plugins --skill testing-strategies-bramato
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing-strategies
Source: https://github.com/bramato/laravel-react-plugins/tree/main/laravel-react/skills/testing-strategies
Command: npx skills add https://github.com/bramato/laravel-react-plugins --skill testing-strategies-bramato

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides comprehensive guidance and examples for writing effective unit, feature, and component tests in Laravel and React applications, ensuring code quality and reliability.

Core Features & Use Cases

  • Testing Pyramid: Understand what to test at each layer (Unit, Feature, Component, E2E).
  • Laravel Testing: Write feature tests for HTTP requests, Inertia responses, and database interactions using Pest/PHPUnit.
  • React Testing: Write component tests using React Testing Library and Vitest/Jest, including form and hook testing.
  • Use Case: You're building a new feature in your Laravel app and want to ensure all aspects, from API endpoints to React component interactions, are thoroughly tested. This Skill guides you through setting up and writing those tests.

Quick Start

Write a feature test for the project creation endpoint using the provided examples.

Frequently Asked Questions about testing-strategies

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write feature tests for Laravel APIs and Inertia responses using Pest?

To write feature tests for Laravel APIs and Inertia responses using Pest, you should structure your tests to assert HTTP request statuses and validate database interactions. This ensures your endpoints process requests correctly and return expected Inertia component data reliably.

What is the best way to test React components and hooks with React Testing Library and Vitest?

The best way to test React components and hooks with React Testing Library and Vitest is to focus on user interactions and accessibility. You simulate DOM events and validate component state changes to ensure forms and UI elements behave as expected without relying on implementation details.

How do I mock API requests and database interactions when testing Laravel and React apps?

To mock API requests and database interactions in Laravel and React apps, utilize MSW for API mocking and leverage built-in framework utilities for database testing. This isolates components during testing by intercepting network requests and managing database state.

Does the testing pyramid approach apply when structuring tests across unit, feature, component, and E2E layers?

Yes, the testing pyramid approach applies when structuring tests across unit, feature, component, and E2E layers. It guides you to write many fast unit and component tests, fewer feature tests, and minimal E2E tests to balance execution speed and application reliability.

Can I use PHPUnit instead of Pest for Laravel feature and database testing?

Yes, you can use PHPUnit instead of Pest for Laravel feature and database testing. The testing strategies provided cover best practices for both Pest and PHPUnit, allowing you to write comprehensive HTTP and database interaction tests using your preferred framework.

Why should I focus on accessibility when writing React component tests?

You should focus on accessibility when writing React component tests to ensure your UI is usable by everyone and testable via semantic queries. React Testing Library encourages querying elements by their accessible roles, making tests more robust against implementation changes.