PHPackages                             gsferro/generate-tests-easy - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. gsferro/generate-tests-easy

ActiveLibrary[Testing &amp; Quality](/categories/testing)

gsferro/generate-tests-easy
===========================

Automated test generation for Laravel applications using Pest

v1.0.0(1y ago)2161MITPHPPHP ^8.0|^8.1|^8.2|^8.3|^8.4

Since May 17Pushed 1y ago1 watchersCompare

[ Source](https://github.com/gsferro/generate-tests-easy)[ Packagist](https://packagist.org/packages/gsferro/generate-tests-easy)[ RSS](/packages/gsferro-generate-tests-easy/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (9)Versions (2)Used By (0)

 [![Generate Tests Easy Logo](logo.png)](logo.png)
 [![Latest Version](https://camo.githubusercontent.com/6f79140e3a03aa99539a4a3b21a2dcea2f7def5946bb3916b6ae66b3cd8456b5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6773666572726f2f67656e65726174652d74657374732d65617379)](https://packagist.org/packages/gsferro/generate-tests-easy) [![Total Downloads](https://camo.githubusercontent.com/7b61abf617582450cfa8ada7321fdf7094701a8f9332126e0f1a523c4e04c9c7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6773666572726f2f67656e65726174652d74657374732d65617379)](https://packagist.org/packages/gsferro/generate-tests-easy) [![License](https://camo.githubusercontent.com/4f60ce6fd16b865bc327cfcd7bead32f207eb001aeca871827e02d64041fb10a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6773666572726f2f67656e65726174652d74657374732d65617379)](https://packagist.org/packages/gsferro/generate-tests-easy)

---

A Laravel package for automatically generating comprehensive Pest tests for your application based on code analysis.

Description
-----------

[](#description)

Generate Tests Easy is a powerful tool that analyzes your Laravel application's models, controllers, and database structure to automatically generate comprehensive test suites using Pest PHP. It can detect relationships, scopes, validation rules, and other features to create relevant tests that ensure your application works as expected.

Features
--------

[](#features)

- Automatically generates Pest tests for models, controllers, and other components
- Analyzes database structure to create appropriate tests
- Detects and tests model relationships, scopes, and validation rules
- Supports API controllers with specialized API test generation
- Installs and configures Pest if not already present
- Configures Pest Arch presets for PHP, security, and Laravel
- Supports Livewire components (if detected in your project)
- Supports Filament resources and panels (if detected in your project)
- Works with both new and existing projects

Requirements
------------

[](#requirements)

PackageVersionPHP^8.0|^8.1|^8.2|^8.3|^8.4Laravel^8.0|^9.0|^10.0|^11.0|^12.0Pest PHP^1.22|^2.8.1|^3.0Pest Plugin Laravel^1.4|^2.0|^3.2Pest Plugin Arch^2.0|^v3.0PHPUnit^9.5.10|^10.1|^11.0|^12.0Symfony Finder^5.0|^6.0|^7.0Installation
------------

[](#installation)

```
composer require gsferro/generate-tests-easy --dev
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

To generate tests for all models and controllers in your application:

```
php artisan generate-tests:all
```

### Generate Tests for Specific Components

[](#generate-tests-for-specific-components)

```
# Generate tests for a specific model
php artisan generate-tests:model User

# Generate tests for a specific controller
php artisan generate-tests:controller UserController

# Generate tests for models based on database tables
php artisan generate-tests:database

# Generate tests for Filament resources
php artisan generate-tests:filament PatientResource

# Generate tests for all Filament resources
php artisan generate-tests:filament --all
```

### Options

[](#options)

All commands support the following options:

- `--force`: Overwrite existing tests
- `--verbose`: Show detailed information during generation

Types of Tests Generated
------------------------

[](#types-of-tests-generated)

### Filament Resource Structure

[](#filament-resource-structure)

When working with Filament resources, the package recognizes the standard Filament resource structure:

```
PatientResource.php
PatientResource/
  ├── Pages/
  │   ├── CreatePatient.php
  │   ├── EditPatient.php
  │   ├── ListPatients.php
  │   └── ViewPatient.php

```

The package will generate appropriate tests for each component of the resource:

- A test for the main resource class (PatientResource)
- Tests for each page class (ListPatients, CreatePatient, EditPatient, ViewPatient)

Each test is tailored to the specific functionality of the component, ensuring comprehensive test coverage. For example, ViewPatient tests will verify that:

- The page can be rendered successfully
- The page displays the correct record data
- Relationships are properly displayed
- The edit button works correctly

### Model Tests

[](#model-tests)

- **Basic Model Tests**: Tests model attributes, inheritance, and traits
- **Relationship Tests**: Tests each relationship defined in the model
- **Scope Tests**: Tests each scope method defined in the model
- **Validation Tests**: Tests validation rules defined in the model
- **Factory Tests**: Tests model factory if available

### Controller Tests

[](#controller-tests)

- **Unit Tests**: Tests controller methods, routes, and configuration
- **Feature Tests**: Tests HTTP requests to controller endpoints
- **API Tests**: Tests API endpoints for API controllers

### Livewire Tests (if Livewire is installed)

[](#livewire-tests-if-livewire-is-installed)

- **Component Tests**: Tests Livewire component rendering and functionality
- **Event Tests**: Tests Livewire events and listeners

### Filament Tests (if Filament is installed)

[](#filament-tests-if-filament-is-installed)

- **Resource Tests**: Tests Filament resource configuration, model association, and navigation
- **List Page Tests**: Tests the resource list page, table columns, search, and sorting functionality
- **Create Page Tests**: Tests the resource create page, form fields, validation, and record creation
- **Edit Page Tests**: Tests the resource edit page, form fields, validation, and record updates
- **Form Tests**: Tests form components, validation rules, and data submission
- **Table Tests**: Tests table columns, filters, actions, and bulk actions
- **Panel Tests**: Tests Filament panel configuration and access

Configuration
-------------

[](#configuration)

Publish the configuration file:

```
php artisan vendor:publish --tag=generate-tests-easy-config
```

### Configuration Options

[](#configuration-options)

```
return [
    // Path where tests will be generated
    'test_path' => 'tests',

    // Whether to install Pest if not already installed
    'install_pest' => true,

    // Whether to configure Pest Arch presets
    'configure_arch_presets' => true,

    // Test coverage target percentage
    'coverage_target' => 80,

    // Custom stubs path (if you want to customize the test templates)
    'stubs_path' => null,
];
```

Extending
---------

[](#extending)

You can extend the package by:

1. Publishing and customizing the test stubs
2. Creating custom analyzers for specific components
3. Adding custom test generators

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

Running Package Tests
---------------------

[](#running-package-tests)

This package comes with its own test suite to ensure functionality works as expected. To run the tests:

```
# Run all tests
composer test

# Run tests with coverage report
composer test:coverage

# Run only unit tests
composer test:unit

# Run only feature tests
composer test:feature

# Run architecture tests
composer test:arch
```

These commands are defined in the `composer.json` file and use Pest PHP for testing. The test suite includes unit tests, feature tests, and architecture tests to ensure the package works correctly.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance46

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

412d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9857d9f527903d58285b8afd4c9cc5d4150041a5951ba5b84c399d0e579b0255?d=identicon)[gsferro](/maintainers/gsferro)

---

Top Contributors

[![gsferro](https://avatars.githubusercontent.com/u/12704346?v=4)](https://github.com/gsferro "gsferro (10 commits)")

---

Tags

testingpestlaraveleasygenerateautomated tests

### Embed Badge

![Health badge](/badges/gsferro-generate-tests-easy/health.svg)

```
[![Health](https://phpackages.com/badges/gsferro-generate-tests-easy/health.svg)](https://phpackages.com/packages/gsferro-generate-tests-easy)
```

###  Alternatives

[pestphp/pest

The elegant PHP Testing Framework.

11.6k72.2M20.5k](/packages/pestphp-pest)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k42.5M40.8k](/packages/orchestra-testbench)[hotmeteor/spectator

Testing helpers for your OpenAPI spec

3051.6M1](/packages/hotmeteor-spectator)[pestphp/pest-plugin-drift

The Pest Drift Plugin

745.1M107](/packages/pestphp-pest-plugin-drift)[defstudio/pest-plugin-laravel-expectations

A plugin to add laravel tailored expectations to Pest

99600.5k8](/packages/defstudio-pest-plugin-laravel-expectations)[testo/testo

A lightweight PHP testing framework.

1959.3k55](/packages/testo-testo)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
