PHPackages                             webproject-xyz/codeception-module-ai-reporter - 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. webproject-xyz/codeception-module-ai-reporter

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

webproject-xyz/codeception-module-ai-reporter
=============================================

Codeception extension that emits deterministic AI-friendly failure reports

1.1.0(2mo ago)11.2k↑104.8%[1 issues](https://github.com/WebProject-xyz/codeception-module-ai-reporter/issues)[3 PRs](https://github.com/WebProject-xyz/codeception-module-ai-reporter/pulls)6MITPHPPHP ~8.3.0 || ~8.4.0 || ~8.5.0CI passing

Since Feb 19Pushed 2mo agoCompare

[ Source](https://github.com/WebProject-xyz/codeception-module-ai-reporter)[ Packagist](https://packagist.org/packages/webproject-xyz/codeception-module-ai-reporter)[ Docs](https://www.webproject.xyz)[ RSS](/packages/webproject-xyz-codeception-module-ai-reporter/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (20)Versions (10)Used By (6)

AI Codeception Reporter
=======================

[](#ai-codeception-reporter)

[![CI](https://github.com/WebProject-xyz/codeception-module-ai-reporter/actions/workflows/ci.yml/badge.svg)](https://github.com/WebProject-xyz/codeception-module-ai-reporter/actions/workflows/ci.yml)[![Release](https://github.com/WebProject-xyz/codeception-module-ai-reporter/actions/workflows/release.yml/badge.svg)](https://github.com/WebProject-xyz/codeception-module-ai-reporter/actions/workflows/release.yml)[![PHP Version](https://camo.githubusercontent.com/d8cff538ab7d2cbe17c97c96937a922791e6ac437405166b2299d48e2e812c68/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f57656250726f6a6563742d78797a2f636f646563657074696f6e2d6d6f64756c652d61692d7265706f72746572)](https://packagist.org/packages/WebProject-xyz/codeception-module-ai-reporter)[![Latest Stable Version](https://camo.githubusercontent.com/5dbe1e0ad57ec61048cf5885628653c860d2cfc80b4c781d43e20b998b040a64/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f57656250726f6a6563742d78797a2f636f646563657074696f6e2d6d6f64756c652d61692d7265706f72746572)](https://packagist.org/packages/WebProject-xyz/codeception-module-ai-reporter)[![Total Downloads](https://camo.githubusercontent.com/411f76ec45a3427b99b9504225824d33a20559385b96dc23de5fc74ea4ccf356/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f57656250726f6a6563742d78797a2f636f646563657074696f6e2d6d6f64756c652d61692d7265706f72746572)](https://packagist.org/packages/WebProject-xyz/codeception-module-ai-reporter)[![License](https://camo.githubusercontent.com/2edacff125140a97961f670ec2fd903817fdc901e646cf229c3f2d16139b36ef/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f57656250726f6a6563742d78797a2f636f646563657074696f6e2d6d6f64756c652d61692d7265706f72746572)](https://packagist.org/packages/WebProject-xyz/codeception-module-ai-reporter)

> **Give your AI coding agent everything it needs to fix a failing test — in a single run.**

A [Codeception 5](https://codeception.com) extension that captures structured, deterministic failure context and writes it as machine-readable JSON and plain-text artifacts. Built for the fix-in-a-loop workflow: agent runs tests, reads the report, patches code, repeats — without ever needing a human in the loop.

---

Why this exists
---------------

[](#why-this-exists)

When an AI agent encounters a failing Codeception test, the default output is a wall of terminal text: ANSI escape codes, PHPUnit XML noise, interleaved suite headers, and a stack trace that buries the actual problem. Agents waste tokens parsing noise instead of fixing bugs.

This extension solves that by producing **two clean, stable output files** after every test run:

- **`ai-report.json`** — structured data ready for programmatic consumption
- **`ai-report.txt`** — compact human-and-agent-readable summary

Every failure record contains exactly what an agent needs:

FieldWhat it gives the agent`exception.message`The plain-English failure reason`exception.comparison_diff`A unified diff when values don't match — no more guessing what changed`trace`Cleaned stack frames, vendor noise removed, capped to a useful depth`scenario_steps`The Codeception steps leading up to the failure`hints`Pre-computed triage suggestions (assertion mismatch, missing element, etc.)`artifacts`Paths to screenshots, HAR files, and other test artifactsWith the `--report` flag, the same context is also **printed inline** in the terminal output immediately after each failure — useful for agents that read stdout directly.

---

Installation
------------

[](#installation)

```
composer require --dev WebProject-xyz/codeception-module-ai-reporter
```

Requires PHP `^8.3` and Codeception `^5.3.5`.

---

Setup
-----

[](#setup)

Add the extension to your `codeception.yml`:

```
extensions:
    enabled:
        - WebProject\Codeception\Module\AiReporter\Extension\AiReporter:
              format: both          # text | json | both
              output: tests/_output
              max_frames: 8
              include_steps: true
              include_artifacts: true
              compact_paths: true
```

---

Usage
-----

[](#usage)

### Standard run

[](#standard-run)

```
vendor/bin/codecept run
```

Report files are written to `tests/_output/` after every run, regardless of whether tests pass or fail.

### Agent run mode (`--report`)

[](#agent-run-mode---report)

```
vendor/bin/codecept run --report
```

Enables **inline AI context** — a structured block printed directly below each failure in the terminal:

```
  AI Context
    Exception: PHPUnit\Framework\ExpectationFailedException
    Message: Failed asserting that two strings are identical.
    Diff:
      --- Expected
      +++ Actual
      @@ @@
      -'expected-value'
      +'actual-value'
    Trace:
      #1 tests/Unit/MyTest.php:42 MyTest->testSomething
    Hints:
      - Assertion mismatch detected; compare expected and actual values at the top non-vendor frame.

```

### Recommended agent instruction

[](#recommended-agent-instruction)

Drop this into your agent's system prompt or task description:

```
Run `vendor/bin/codecept run --report` and use the inline AI Context
plus tests/_output/ai-report.json to identify and fix failures.
Repeat until all tests pass.

```

---

Output format
-------------

[](#output-format)

### JSON (`ai-report.json`)

[](#json-ai-reportjson)

A machine-readable schema is available at [`schema/ai-report.schema.json`](schema/ai-report.schema.json) (JSON Schema 2020-12).

```
{
  "run": {
    "generated_at": "2026-02-19T12:00:00+00:00",
    "duration_seconds": 1.23,
    "project_root": "/repo/project",
    "output_dir": "/repo/project/tests/_output"
  },
  "summary": {
    "tests": 10, "successful": 9, "failures": 1,
    "errors": 0, "warnings": 0, "assertions": 42,
    "successful_run": false
  },
  "failures": [
    {
      "status": "failure",
      "suite": "Unit",
      "test": {
        "display_name": "MyTest: check value",
        "signature": "MyTest:checkValue",
        "file": "tests/Unit/MyTest.php"
      },
      "exception": {
        "class": "PHPUnit\\Framework\\ExpectationFailedException",
        "message": "Failed asserting that two strings are identical.",
        "comparison_expected": "'expected-value'",
        "comparison_actual": "'actual-value'",
        "comparison_diff": "\n--- Expected\n+++ Actual\n@@ @@\n-'expected-value'\n+'actual-value'\n",
        "previous": []
      },
      "scenario_steps": [],
      "trace": [
        { "file": "tests/Unit/MyTest.php", "line": 42, "call": "MyTest->checkValue" }
      ],
      "artifacts": {},
      "hints": [
        "Assertion mismatch detected; compare expected and actual values at the top non-vendor frame."
      ]
    }
  ]
}
```

### Text (`ai-report.txt`)

[](#text-ai-reporttxt)

```
Context
generated_at: 2026-02-19T12:00:00+00:00
project_root: /repo/project
totals: tests=10 successful=9 failures=1 errors=0 warnings=0 skipped=0 incomplete=0 useless=0 assertions=42

Failure 1
status: failure
suite: Unit
test: MyTest: check value
test_file: tests/Unit/MyTest.php
test_signature: MyTest:checkValue

Exception
exception_class: PHPUnit\Framework\ExpectationFailedException
message: Failed asserting that two strings are identical.
comparison_expected: 'expected-value'
comparison_actual: 'actual-value'
comparison_diff:
--- Expected
+++ Actual
@@ @@
-'expected-value'
+'actual-value'

Scenario
none

Trace
#1 tests/Unit/MyTest.php:42 MyTest->checkValue

Hints
- Assertion mismatch detected; compare expected and actual values at the top non-vendor frame.

```

---

Configuration reference
-----------------------

[](#configuration-reference)

OptionTypeDefaultDescription`format``text|json|both``both`Which report files to write`output``string``tests/_output`Output directory for report files`max_frames``int``8`Maximum stack frames per failure`include_steps``bool``true`Include Codeception scenario steps`include_artifacts``bool``true`Include test metadata artifacts (screenshots, etc.)`compact_paths``bool``true`Use project-relative paths where possible---

Platform support
----------------

[](#platform-support)

- Linux, macOS, and Windows paths are all handled correctly.
- Paths are normalized to forward slashes in report output for consistency across platforms.

---

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

[](#contributing)

Contributions are welcome. Please open an issue before submitting large changes.

```
composer test:build   # rebuild Codeception actor classes
composer test         # run tests
composer stan         # PHPStan static analysis (level 7)
composer cs:check     # check code style
composer cs:fix       # auto-fix code style
```

---

License
-------

[](#license)

MIT

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance67

Regular maintenance activity

Popularity23

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 63.6% 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

Every ~4 days

Total

5

Last Release

69d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8126644ebe55d4c9e7d6e496307e6ee2c6232e7af450b1b915de3b282bd44b2d?d=identicon)[Fahl-Design](/maintainers/Fahl-Design)

---

Top Contributors

[![Fahl-Design](https://avatars.githubusercontent.com/u/6690962?v=4)](https://github.com/Fahl-Design "Fahl-Design (14 commits)")[![semantic-release-bot](https://avatars.githubusercontent.com/u/32174276?v=4)](https://github.com/semantic-release-bot "semantic-release-bot (5 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (3 commits)")

###  Code Quality

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/webproject-xyz-codeception-module-ai-reporter/health.svg)

```
[![Health](https://phpackages.com/badges/webproject-xyz-codeception-module-ai-reporter/health.svg)](https://phpackages.com/packages/webproject-xyz-codeception-module-ai-reporter)
```

###  Alternatives

[infection/infection

Infection is a Mutation Testing framework for PHP. The mutation adequacy score can be used to measure the effectiveness of a test set in terms of its ability to detect faults.

2.2k26.2M1.8k](/packages/infection-infection)[nyholm/nsa

See everything and do whatever you want. No privacy rule will stop us. Used in tests, debugging and fixtures to access properties and methods.

2286.0M79](/packages/nyholm-nsa)[magento/magento2-functional-testing-framework

Magento2 Functional Testing Framework

15511.5M30](/packages/magento-magento2-functional-testing-framework)[mcustiel/phiremock-codeception-extension

Codeception extension for Phiremock. Allows to stub remote services for HTTP requests.

311.0M5](/packages/mcustiel-phiremock-codeception-extension)[contributte/codeception

Integration of Nette framework to Codeception.

27886.9k1](/packages/contributte-codeception)[docler-labs/codeception-slim-module

Codeception Module for Slim framework.

13178.0k1](/packages/docler-labs-codeception-slim-module)

PHPackages © 2026

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