pest-testing_skill

This skill helps you write and debug Pest 4 tests in PHP applications, covering unit, feature, browser, and visual regression scenarios.
  • Rust

364

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill openagentsinc/openagents --skill pest-testing

  • SKILL.md4.6 KB

Overview

This skill helps you write, run, and debug tests using the Pest 4 PHP framework. It focuses on best practices for unit, feature, browser, and architecture tests, and provides guidance for assertions, datasets, mocking, sharding, and visual regression testing. Use it to keep tests consistent, fast, and reliable across development and CI.

How this skill works

The skill inspects test code and context to suggest Pest-specific patterns, assertions, and structure. It recommends commands for running tests, advises on browser and smoke testing setup, and flags common pitfalls like missing imports or weak assertions. For failing tests it suggests debugging steps, dataset usage, and when to add mocks or RefreshDatabase isolation.

When to use it

  • Creating new unit, feature, browser, or architecture tests
  • Modifying or refactoring existing tests and assertions
  • Debugging failing tests, browser errors, or flaky CI runs
  • Adding datasets, mocks, or Livewire/browser interactions
  • Implementing visual regression, smoke testing, or sharded CI

Best practices

  • Generate tests with php artisan make:test --pest {Name} and keep tests in tests/Unit, tests/Feature, or tests/Browser
  • Prefer specific response assertions (assertSuccessful, assertNotFound, assertForbidden) over assertStatus
  • Import mock helper before use: use function Pest\Laravel\mock;
  • Use datasets for repetitive inputs and RefreshDatabase for clean state per test
  • Run focused tests during development with php artisan test --compact --filter=Name before running all tests

Example use cases

  • Write a feature test for an API endpoint using assertSuccessful() and JSON assertions
  • Create a browser test that navigates pages, interacts with forms, and asserts no JavaScript errors
  • Use datasets to validate multiple input permutations for a form validator
  • Implement visual regression by capturing screenshots and comparing them across runs
  • Shard slow test suites across CI workers to reduce overall pipeline time

FAQ

Use php artisan test --compact tests/Feature/YourTest.php or run a specific test with --filter=testName.

When should I use RefreshDatabase?

Use RefreshDatabase for tests that modify the database to ensure a clean state between tests and avoid cross-test interference.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
pest-testing skill by openagentsinc/openagents | VeilStrat