@@ -34,9 +34,16 @@ The package enables a clean separation between experimental draft tests and prod
3434- π§ͺ Native Pest 3 support with proper test isolation
3535- π Automatic backup of configuration files before modification
3636- π Unique reference tracking for test promotion from draft to CI
37- - π ** NEW: Test status tracking** - Automatic tracking of test execution results and history
37+ - π ** NEW: Comprehensive Test Status Tracking**
38+ - π Automatic tracking of test execution results and history
39+ - π― Status persistence across test runs with ` .status.json `
40+ - π Historical tracking of test state changes
41+ - π Advanced test filtering and management by status
42+ - π
Timestamped audit trails for test evolution
43+ - βοΈ Configurable history limits and environment-specific settings
3844- π― Built for clean TDD workflow separation
3945- π Easy graduation path from draft tests to production test suite
46+ - π§ ** Professional Test Management** : Advanced filtering, promotion, and audit capabilities
4047
4148## π§ The Five-Command TDD Workflow
4249
@@ -68,11 +75,11 @@ graph LR
6875
6976| Command | Role in TDD Flow | Description |
7077| ---------| ------------------| -------------|
71- | ** ` tdd:init ` ** | ποΈ ** Setup** | Initialize TDDraft environment and configuration |
72- | ** ` tdd:make ` ** | π§ͺ ** Red Phase** | Create a new failing test with unique tracking |
73- | ** ` tdd:test ` ** | π ** Red-Green Cycle** | Run and iterate on draft tests until they pass |
74- | ** ` tdd:list ` ** | π ** Review** | List and manage your draft tests before promotion |
75- | ** ` tdd:promote ` ** | π ** Graduate** | Move ready tests to production CI test suite |
78+ | ** ` tdd:init ` ** | ποΈ ** Setup** | Initialize TDDraft environment and configuration with status tracking |
79+ | ** ` tdd:make ` ** | π§ͺ ** Red Phase** | Create a new failing test with unique tracking reference |
80+ | ** ` tdd:test ` ** | π ** Red-Green Cycle** | Run and iterate on draft tests with automatic status tracking |
81+ | ** ` tdd:list ` ** | π ** Review** | List and manage draft tests with status history and filtering |
82+ | ** ` tdd:promote ` ** | π ** Graduate** | Move ready tests to production CI suite with audit trail |
7683
7784### π― Why This Flow Matters
7885
@@ -94,15 +101,15 @@ php artisan tdd:init
94101php artisan tdd:make " User can register"
95102php artisan tdd:make " Password validation" --type=unit
96103
97- # 3. π RED-GREEN CYCLE: Iterate until tests pass
98- php artisan tdd:test --filter=" User can register" # RED: Test fails
104+ # 3. π RED-GREEN CYCLE: Iterate until tests pass (with automatic status tracking)
105+ php artisan tdd:test --filter=" User can register" # RED: Test fails (status tracked)
99106# Write minimal code to make test pass...
100- php artisan tdd:test --filter=" User can register" # GREEN: Test passes
107+ php artisan tdd:test --filter=" User can register" # GREEN: Test passes (status tracked)
101108# Refactor code...
102- php artisan tdd:test --filter=" User can register" # GREEN: Still passes
109+ php artisan tdd:test --filter=" User can register" # GREEN: Still passes (status tracked)
103110
104- # 4. π REVIEW: Check all draft tests before promotion
105- php artisan tdd:list --details
111+ # 4. π REVIEW: Check all draft tests with their status history
112+ php artisan tdd:list --details # Shows current status and history for each test
106113
107114# 5. π GRADUATE: Move ready tests to CI suite
108115php artisan tdd:promote tdd-20250718142530-Abc123
@@ -140,10 +147,12 @@ php artisan tdd:init
140147```
141148
142149This command will:
143- - Create ` tests/TDDraft/ ` directory structure
150+ - Create ` tests/TDDraft/ ` directory structure with ` .gitkeep `
144151- Configure PHPUnit to separate TDDraft tests from main suite
145152- Configure Pest to exclude TDDraft from default test runs
146- - Optionally create example test files
153+ - Set up status tracking system for test execution monitoring
154+ - Create configuration file with environment-specific status tracking settings
155+ - Optionally create example test files for quick start
147156
148157## π Usage
149158
@@ -200,36 +209,38 @@ it('user can register', function (): void {
200209->todo('Implement the test scenario for: user can register');
201210```
202211
203- ### Run Tests Separately
212+ ### Run Tests with Status Tracking
213+
214+ Laravel TDDraft provides dedicated commands with automatic status monitoring:
204215
205216``` bash
206- # Run only main tests (excludes TDDraft)
217+ # Run only main tests (excludes TDDraft)
207218pest
208219
209- # Run only TDDraft tests ( with automatic status tracking!)
220+ # Run only TDDraft tests with automatic status tracking
210221php artisan tdd:test
211222
212- # Run TDDraft tests with options
223+ # Run TDDraft tests with options (all with status tracking)
213224php artisan tdd:test --filter=" user registration"
214225php artisan tdd:test --coverage
215226php artisan tdd:test --parallel
216227php artisan tdd:test --stop-on-failure
217228
229+ # Alternative: use pest directly (without automatic status tracking)
230+ pest --testsuite=tddraft
231+
218232# Filter by type
219233pest --testsuite=tddraft --group=feature
220234pest --testsuite=tddraft --group=unit
221235
222236# Filter by specific reference
223237pest --testsuite=tddraft --group=tdd-20250718142530-Abc123
224238
225- # Alternative: use pest directly
226- pest --testsuite=tddraft
227-
228239# Run all tests including TDDraft
229240pest --testsuite=default,tddraft
230241```
231242
232- ### Test Status Tracking (NEW)
243+ ### Comprehensive Status Tracking System
233244
234245Laravel TDDraft now automatically tracks your test execution results:
235246
@@ -241,11 +252,33 @@ php artisan tdd:test
241252# Each test result is linked to its unique reference for precise tracking
242253```
243254
244- ** Status tracking provides:**
245- - Automatic recording of test results (passed/failed/error/skipped)
246- - Historical tracking of status changes over time
247- - Reference-based linking for audit trails
248- - JSON storage for easy integration with other tools
255+ ** Comprehensive status tracking features:**
256+ - β
** Automatic Recording** : Test results (passed/failed/error/skipped) saved after each run
257+ - π ** Historical Tracking** : Maintains change history for test evolution analysis
258+ - π ** Reference-Based Linking** : Status tied to unique test references for audit trails
259+ - π ** JSON Storage** : Structured data for easy integration with external tools
260+ - βοΈ ** Environment Configuration** : Customizable tracking behavior per environment
261+ - π ** Test Stability Analysis** : Track which tests are ready for promotion based on status history
262+
263+ ** Example status file structure:**
264+ ``` json
265+ {
266+ "tdd-20250718142530-Abc123" : {
267+ "status" : " passed" ,
268+ "updated_at" : " 2025-07-18T14:30:45+00:00" ,
269+ "history" : [
270+ {
271+ "status" : " failed" ,
272+ "timestamp" : " 2025-07-18T14:25:30+00:00"
273+ },
274+ {
275+ "status" : " failed" ,
276+ "timestamp" : " 2025-07-18T14:27:15+00:00"
277+ }
278+ ]
279+ }
280+ }
281+ ```
249282
250283### List and Manage Tests
251284
@@ -343,24 +376,37 @@ pest tests/Feature/Auth/UserRegistrationTest.php
343376pest
344377```
345378
346- ### Tracking Test Lineage
379+ ### Status Tracking and Test Lineage
380+
381+ The unique reference system with status tracking allows you to:
382+ - ** Track Test Evolution** : Monitor tests from draft to production with complete history
383+ - ** Analyze Test Stability** : Use status history to determine promotion readiness
384+ - ** Maintain Audit Trails** : Full traceability for compliance and debugging
385+ - ** Link CI Failures** : Connect production failures back to original draft intent
386+ - ** Data-Driven Decisions** : Use status data to optimize TDD workflow
387+
388+ ** Advanced status analysis example:**
389+ ``` bash
390+ # Find tests that are consistently passing (ready for promotion)
391+ php artisan tdd:list --details | grep " β
Passed"
392+
393+ # Identify tests that need attention based on status history
394+ # (This could be automated using the .status.json data)
395+ ```
347396
348- The unique reference system allows you to:
349- - Track which tests originated from TDDraft
350- - Monitor test evolution from draft to production
351- - Maintain audit trail for compliance
352- - Link CI failures back to original draft intent
397+ ## βοΈ Configuration
353398
354- ## π Configuration
399+ ### Status Tracking Configuration
355400
356- The package configuration is published to ` config/tddraft.php ` :
401+ The package configuration is published to ` config/tddraft.php ` with comprehensive status tracking options :
357402
358403``` php
359404return [
360405 /**
361406 * Test status tracking configuration
362407 *
363- * NEW: Controls how test execution results are tracked and persisted.
408+ * Controls how test execution results are tracked and persisted.
409+ * This is a key feature that enables professional TDD workflow management.
364410 */
365411 'status_tracking' => [
366412 // Enable or disable status tracking
@@ -378,47 +424,105 @@ return [
378424];
379425```
380426
381- ** Environment Variables:**
427+ ### Environment-Specific Configuration
428+
429+ Configure different behavior per environment:
430+
382431``` env
383- # Enable/disable status tracking
432+ # Development environment (.env.local)
384433LARAVEL_TDDRAFT_STATUS_TRACKING_ENABLED=true
385-
386- # Configure status file location
387434LARAVEL_TDDRAFT_STATUS_FILE=tests/TDDraft/.status.json
388-
389- # Control history tracking
390435LARAVEL_TDDRAFT_TRACK_HISTORY=true
391- LARAVEL_TDDRAFT_MAX_HISTORY=50
436+ LARAVEL_TDDRAFT_MAX_HISTORY=100
437+
438+ # Testing/CI environment (.env.testing)
439+ LARAVEL_TDDRAFT_STATUS_TRACKING_ENABLED=true
440+ LARAVEL_TDDRAFT_STATUS_FILE=tests/TDDraft/.status.testing.json
441+ LARAVEL_TDDRAFT_TRACK_HISTORY=false
442+ LARAVEL_TDDRAFT_MAX_HISTORY=20
443+
444+ # Production environment (.env.production)
445+ LARAVEL_TDDRAFT_STATUS_TRACKING_ENABLED=false
392446```
393447
394448## π§ͺ Example Draft Test
395449
450+ ** Example of a TDDraft test with unique reference tracking and status monitoring:**
451+
396452``` php
397453<?php
398454
399455declare(strict_types=1);
400456
401- it('should fail initially - this is normal for TDDraft', function (): void {
457+ /**
458+ * TDDraft Test: User registration workflow
459+ *
460+ * Reference: tdd-20250718142530-Abc123
461+ * Type: feature
462+ * Created: 2025-07-18 14:25:30
463+ */
464+
465+ it('should fail initially - this is normal for TDD red phase', function (): void {
402466 // This test intentionally fails to demonstrate the TDD "red" phase
403- expect(false)->toBeTrue('This draft needs implementation!');
404- })->group('tddraft', 'feature', 'example-red-phase');
467+ // Status will be tracked as 'failed' until implementation is complete
468+
469+ $response = $this->post('/register', [
470+ 'name' => 'John Doe',
471+ 472+ 'password' => 'password',
473+ 'password_confirmation' => 'password',
474+ ]);
405475
406- it('can be promoted when ready', function (): void {
407- // When this passes, you can promote it to your main test suite
476+ $response->assertStatus(201);
477+ $this->assertDatabaseHas('users', [
478+ 479+ ]);
480+ })
481+ ->group('tddraft', 'feature', 'tdd-20250718142530-Abc123')
482+ ->todo('Implement user registration endpoint and validation');
483+
484+ it('can be promoted when ready and status shows consistent passing', function (): void {
485+ // When this test consistently passes (shown in status tracking),
486+ // it's ready for promotion to the main test suite
408487 expect(true)->toBeTrue();
409- })->group('tddraft', 'feature', 'example-green-phase');
488+ })
489+ ->group('tddraft', 'feature', 'tdd-20250718142530-Abc123');
410490```
411491
412- ## π Documentation
492+ ** Key features demonstrated:**
493+ - β
** Unique Reference** : ` tdd-20250718142530-Abc123 ` for tracking and promotion
494+ - π ** Status Tracking** : Each run records pass/fail status with timestamp
495+ - π ** TDD Cycle** : Start with failing test, implement code, achieve passing status
496+ - π― ** Promotion Ready** : Use status history to determine when test is stable
497+
498+ ## π Documentation & Examples
499+
500+ ### Complete Documentation
413501
414502For comprehensive documentation, see the [ ` docs/ ` ] ( docs/ ) directory:
415503
416- - [ Installation Guide] ( docs/installation.md )
417- - [ Configuration] ( docs/configuration.md )
418- - [ Usage Guide] ( docs/usage.md )
419- - [ Commands Reference] ( docs/commands.md )
420- - [ Best Practices] ( docs/best-practices.md )
421- - [ Troubleshooting] ( docs/troubleshooting.md )
504+ - [ Installation Guide] ( docs/installation.md ) - Step-by-step setup instructions
505+ - [ Configuration] ( docs/configuration.md ) - Detailed configuration options
506+ - [ Usage Guide] ( docs/usage.md ) - Complete usage patterns and workflows
507+ - [ Commands Reference] ( docs/commands.md ) - All five commands with examples
508+ - [ Best Practices] ( docs/best-practices.md ) - Professional TDD patterns
509+ - [ Troubleshooting] ( docs/troubleshooting.md ) - Common issues and solutions
510+
511+ ### Practical Examples
512+
513+ The [ ` examples/ ` ] ( examples/ ) directory contains comprehensive usage examples:
514+
515+ - [ ** Basic Usage** ] ( examples/basic-usage.php ) - Complete five-command workflow with status tracking
516+ - [ ** Advanced Usage** ] ( examples/advanced-usage.php ) - Enterprise patterns, CI integration, and status analysis
517+ - [ ** Examples README** ] ( examples/README.md ) - Real-world usage patterns and organization strategies
518+
519+ ** Examples demonstrate:**
520+ - β
Five-command TDD workflow from init to promote
521+ - π Status tracking integration and analysis
522+ - ποΈ Test organization strategies for complex projects
523+ - π Automated promotion workflows
524+ - π Performance monitoring and audit trails
525+ - π§ CI/CD integration patterns
422526
423527## π§ Requirements
424528
0 commit comments