pest-testing

Writes and runs Pest 4 PHP tests including unit, feature, browser, and architecture tests.

Updated Aug 5, 2026
One-click install
npx skills add https://github.com/pd-phuc/laravel-template --skill pest-testing-pd-phuc
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: pest-testing
Source: https://github.com/pd-phuc/laravel-template/tree/main/.claude/skills/pest-testing
Command: npx skills add https://github.com/pd-phuc/laravel-template --skill pest-testing-pd-phuc

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing and maintaining PHP tests requires knowing Pest 4 conventions, assertion patterns, datasets, mocking, and browser testing APIs, which developers often get wrong or skip entirely. ## Core Features & Use Cases - Test Creation: Generates unit, feature, and browser tests using Pest 4 syntax with proper artisan commands and directory conventions. - Assertion & Dataset Patterns: Enforces specific assertions like assertSuccessful() instead of assertStatus(200) and uses datasets for repetitive validation tests. - Browser & Smoke Testing: Writes real-browser tests with page interaction, JavaScript error checks, multi-device viewports, and visual regression. - Use Case: When adding a new API endpoint, ask the AI to write a Pest feature test and it will generate the test file, use proper response assertions, mock dependencies, and run it with a filtered artisan command. ## Quick Start Ask the AI to write a Pest test for your new registration endpoint and run it with a filtered artisan test command.

Frequently Asked Questions about pest-testing

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

FAQPage Schema
How do I create a Pest test in Laravel?▼

Create a Pest test by running php artisan make:test --pest {name}, which scaffolds a test file using Pest syntax. Tests live in tests/Feature and tests/Unit, and you run them with php artisan test --compact or filter a single test with --filter=testName.

How to write browser tests with Pest 4?▼

Pest 4 browser tests live in tests/Browser and use the visit() function to load pages in a real browser. You can click, fill forms, assert text, check for JavaScript errors with assertNoJavascriptErrors(), and test across browsers, devices, and color schemes.

What is the difference between assertStatus and assertSuccessful in Pest?▼

assertSuccessful() verifies a 200-level response semantically, while assertStatus(200) checks the raw code. Pest conventions prefer specific assertions like assertSuccessful(), assertNotFound(), and assertForbidden() because they read clearly and express intent.

How do I use datasets in Pest for repetitive tests?▼

Datasets in Pest let you run one test against multiple inputs by chaining ->with([...]) after the test definition. Each named entry passes its value into the test closure, which is ideal for validation rules and repetitive input checks.

Why does Pest mocking fail with function not found?▼

Mocking fails when the Pest Laravel mock function is not imported. Add use function Pest\Laravel\mock; at the top of the test file before calling mock(), otherwise PHP cannot resolve the function.