Skip to content

Commit 761d15c

Browse files
CopilotGrazulex
andcommitted
Enhance README with detailed test architecture and isolation explanation
Co-authored-by: Grazulex <[email protected]>
1 parent 236284a commit 761d15c

File tree

1 file changed

+81
-18
lines changed

1 file changed

+81
-18
lines changed

β€ŽREADME.mdβ€Ž

Lines changed: 81 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,55 @@ Laravel TDDraft enables true Test-Driven Development in Laravel applications by
3434

3535
**The key innovation is the five-command workflow that separates experimental draft tests from production tests, with powerful filtering and status tracking to manage your TDD process professionally.**
3636

37+
## πŸ—οΈ Test Architecture & Isolation
38+
39+
Laravel TDDraft creates a **completely separate testing environment** that doesn't interfere with your existing test suite:
40+
41+
```
42+
tests/
43+
β”œβ”€β”€ Feature/ # 🟒 Your production CI tests (unchanged)
44+
β”œβ”€β”€ Unit/ # 🟒 Your production CI tests (unchanged)
45+
└── TDDraft/ # πŸ”΅ Isolated draft tests (new - never affects CI)
46+
β”œβ”€β”€ Feature/ # Draft feature tests
47+
β”œβ”€β”€ Unit/ # Draft unit tests
48+
└── .status.json # Status tracking (auto-generated)
49+
```
50+
51+
### Key Architectural Benefits:
52+
53+
- **🚫 Zero CI Interference**: TDDraft tests in `tests/TDDraft/` are **completely excluded** from your main test suites
54+
- **πŸ”„ Independent Operation**: Your existing `tests/Unit/` and `tests/Feature/` continue working exactly as before
55+
- **πŸ“‹ Separate Test Suites**: PHPUnit/Pest configuration keeps TDDraft isolated via test suite definitions
56+
- **⚑ Parallel Development**: Teams can practice TDD in the draft environment while CI runs production tests
57+
58+
### How Isolation Works:
59+
60+
**Standard PHPUnit/Pest Configuration:**
61+
```xml
62+
<testsuites>
63+
<testsuite name="Unit">
64+
<directory suffix="Test.php">tests/Unit</directory> <!-- Production tests -->
65+
</testsuite>
66+
<testsuite name="Feature">
67+
<directory suffix="Test.php">tests/Feature</directory> <!-- Production tests -->
68+
</testsuite>
69+
<!-- tests/TDDraft/ is intentionally NOT included -->
70+
</testsuites>
71+
```
72+
73+
**TDDraft Tests Run Separately:**
74+
```bash
75+
# Your CI pipeline (unchanged)
76+
pest # Runs only tests/Unit + tests/Feature
77+
phpunit # Runs only tests/Unit + tests/Feature
78+
79+
# TDDraft workflow (isolated)
80+
php artisan tdd:test # Runs only tests/TDDraft/**
81+
pest --testsuite=tddraft # Alternative access to draft tests
82+
```
83+
84+
This architectural separation ensures that **failing TDDraft tests never break your CI builds** while you practice the Red-Green-Refactor cycle.
85+
3786
### 🎯 Why Laravel TDDraft?
3887

3988
**TDD is hard to practice in real projects because:**
@@ -52,7 +101,7 @@ Laravel TDDraft enables true Test-Driven Development in Laravel applications by
52101

53102
## ✨ Features
54103

55-
- πŸ—οΈ **Isolated TDD Environment** - Separate `tests/TDDraft/` directory that never affects CI
104+
- πŸ—οΈ **Complete Test Isolation** - `tests/TDDraft/` directory completely separate from `tests/Unit/` and `tests/Feature/` - never affects CI
56105
- πŸ”– **Unique Reference Tracking** - Every test gets a `tdd-YYYYMMDDHHMMSS-RANDOM` ID for precise tracking
57106
- πŸ” **Advanced Filtering** - Filter tests by type, path, reference, status, and more
58107
- πŸ“Š **Automatic Status Tracking** - Monitor test results and history during TDD cycles
@@ -61,7 +110,7 @@ Laravel TDDraft enables true Test-Driven Development in Laravel applications by
61110
- πŸ”„ **True TDD Workflow** - Safe Red-Green-Refactor cycles without breaking builds
62111
- πŸ“‹ **Group-Based Organization** - Pest groups for flexible test filtering and execution
63112
- ⚑ **Five-Command Simplicity** - Complete TDD workflow with just five intuitive commands
64-
- πŸ§ͺ **Pest Integration** - Full compatibility with Pest testing framework
113+
- πŸ§ͺ **Zero Interference Design** - Your existing Unit/Feature tests continue working unchanged
65114

66115
## πŸ“¦ Installation
67116

@@ -433,40 +482,54 @@ Check out the [examples directory](examples) for more detailed examples and patt
433482

434483
## πŸ§ͺ Testing
435484

436-
Laravel TDDraft follows its own philosophy - all tests are organized using the TDD workflow:
485+
Laravel TDDraft follows its own philosophy - all tests are organized using the TDD workflow with **complete isolation between test environments**:
486+
487+
### Test Architecture
488+
489+
```
490+
tests/
491+
β”œβ”€β”€ Feature/ # Package's production tests (for CI)
492+
β”œβ”€β”€ Unit/ # Package's production tests (for CI)
493+
└── TDDraft/ # Draft tests (isolated, never affects CI)
494+
```
437495

438496
### Running Tests
439497

440498
```bash
441499
# Install dependencies
442500
composer install
443501

444-
# Run the main test suite
445-
pest
502+
# Run the main CI test suite (production tests only)
503+
pest # Runs tests/Unit + tests/Feature
504+
pest --coverage # With coverage for production tests
446505

447-
# Run with coverage
448-
pest --coverage
506+
# Run specific production test groups
507+
pest --group=unit # Unit tests only
508+
pest --group=feature # Feature tests only
449509

450-
# Run specific test groups
451-
pest --group=unit
452-
pest --group=feature
510+
# TDDraft workflow (completely separate)
511+
php artisan tdd:test # Runs only tests/TDDraft/** tests
512+
php artisan tdd:list # Manage draft tests
453513
```
454514

455-
### Test Organization
515+
### Test Isolation Benefits
456516

457-
```
458-
tests/
459-
β”œβ”€β”€ Feature/ # Feature tests for the package
460-
β”œβ”€β”€ Unit/ # Unit tests for individual components
461-
└── TDDraft/ # Example draft tests (if any)
462-
```
517+
**For Package Development:**
518+
- Production tests (`tests/Unit/`, `tests/Feature/`) ensure package stability
519+
- CI pipeline only runs production tests - never broken by experimental code
520+
- Draft tests demonstrate package capabilities without affecting main suite
521+
522+
**For Package Users:**
523+
- Your existing `tests/Unit/` and `tests/Feature/` remain unchanged
524+
- TDDraft adds `tests/TDDraft/` for safe TDD practice
525+
- No interference between production and draft test environments
463526

464527
### Writing Tests for This Package
465528

466529
If you're contributing to Laravel TDDraft itself, follow the same TDD principles:
467530

468531
1. Write failing tests first
469-
2. Implement minimal code to make them pass
532+
2. Implement minimal code to make them pass
470533
3. Refactor while keeping tests green
471534

472535
The package tests itself using the standard Laravel/Pest approach, while providing TDDraft workflow for users.

0 commit comments

Comments
Β (0)