Skip to content

Commit e4e1fea

Browse files
Todd Schaveyclaude
andcommitted
docs(build): add test-all command and document test commands in CLAUDE.md
- Add `python build.py test-all` command to run unit + integration tests - Update CLAUDE.md Testing section to document all test commands - Add test commands section to Build, Run, and Packaging documentation - Remove outdated "No automated test suite yet" statement Co-Authored-By: Claude <noreply@anthropic.com>
1 parent f49aadf commit e4e1fea

File tree

2 files changed

+80
-3
lines changed

2 files changed

+80
-3
lines changed

CLAUDE.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ Use the Python automation script for all build operations:
3333
- `python build.py pack` — Create NuGet packages in `nuget-local/`
3434
- `python build.py publish` — Pack NuGet + publish DemoApp to `dist/`
3535

36+
### Test Commands
37+
- `python build.py test` — Run unit tests (excludes integration tests)
38+
- `python build.py test <filter>` — Run tests matching filter (e.g., `DebouncerTests`)
39+
- `python build.py test-integration` — Run Playwright smoke tests (auto-starts/stops DemoApp)
40+
- `python build.py test-all` — Run all tests (unit + integration)
41+
3642
### Log Commands (for debugging)
3743
- `python build.py log` — Show last 50 lines of demoapp.log
3844
- `python build.py log <pattern>` — Search log for regex pattern (case-insensitive)
@@ -88,11 +94,24 @@ Use the Python automation script for all build operations:
8894
- You MUST EDIT the appropriate file in `docs/memory_aid/` after learning a new pattern or gotcha
8995

9096
## Testing and Validation
91-
- No automated test suite yet; rely on `dotnet build` and manual verification in the DemoApp.
97+
98+
### Automated Tests (via build.py)
99+
- `python build.py test` — Run unit tests (bUnit, excludes integration tests by default)
100+
- `python build.py test <filter>` — Run tests matching filter (e.g., `python build.py test DebouncerTests`)
101+
- `python build.py test-integration` — Run Playwright integration/smoke tests (auto-starts and stops DemoApp)
102+
- `python build.py test-all` — Run all tests (unit first, then integration)
103+
104+
**Key Behaviors:**
105+
- `test` excludes integration tests by default (fast, no app startup needed)
106+
- `test-integration` automatically starts DemoApp if not running, runs tests, then stops it
107+
- `test-all` runs unit tests first, then integration tests; fails fast if unit tests fail
108+
- Tests live in `src/Flowbite.Tests/` — see `src/Flowbite.Tests/CLAUDE.md` for test patterns
109+
110+
### Manual Verification
92111
- Exercise both light and dark themes, keyboard navigation, and key scenarios on the demo pages.
93112
- When fixing bugs, reproduce them in the demo first, then validate the fix there.
94113
- Ensure `src/Flowbite/wwwroot/flowbite.min.css` is regenerated as part of builds and committed whenever component styles change.
95-
- **Non‑negotiable:** drive every meaningful UI verification through the Playwright MCP server (`mcp__playwright__browser_*`). Treat these scripted runs as mandatory—launch the DemoApp, navigate to the affected surface, and capture evidence (screenshots or DOM state) before calling a change done.
114+
- **Non‑negotiable:** drive every meaningful UI verification through the Playwright MCP server (`mcp__playwright__browser_*`). Treat these scripted runs as mandatory—launch the DemoApp, navigate to the affected surface, and capture evidence (screenshots or DOM state) before calling a change "done."
96115

97116
## CSS Commits
98117
**CRITICAL:** When Tailwind classes change, commit the generated CSS:

build.py

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,62 @@ def run_dotnet_command(dotnet_path: str, command: str) -> None:
505505
print("Stopping DemoApp...")
506506
stop_background()
507507

508+
elif command == "test-all":
509+
# Run all tests: unit tests first, then integration tests
510+
print("Running all tests (unit + integration)...")
511+
print("")
512+
513+
# Step 1: Run unit tests
514+
print("=" * 60)
515+
print("STEP 1: Running unit tests...")
516+
print("=" * 60)
517+
unit_test_args = [dotnet_path, "test", TEST_PROJECT, "--filter", "Category!=Integration"]
518+
unit_result = subprocess.run(unit_test_args)
519+
520+
if unit_result.returncode != 0:
521+
print("[FAIL] Unit tests failed")
522+
sys.exit(1)
523+
524+
print("[OK] Unit tests passed")
525+
print("")
526+
527+
# Step 2: Run integration tests
528+
print("=" * 60)
529+
print("STEP 2: Running integration tests...")
530+
print("=" * 60)
531+
532+
# Check if DemoApp is running
533+
pid = get_running_pid()
534+
was_started = False
535+
536+
if not pid:
537+
print("DemoApp not running. Starting it now...")
538+
run_tailwind_css()
539+
subprocess.run([dotnet_path, "build", SOLUTION_PATH], check=True)
540+
start_background(dotnet_path)
541+
was_started = True
542+
print("Waiting for DemoApp to be ready...")
543+
time.sleep(5)
544+
545+
try:
546+
integration_test_args = [dotnet_path, "test", TEST_PROJECT, "--filter", "Category=Integration"]
547+
integration_result = subprocess.run(integration_test_args)
548+
549+
if integration_result.returncode != 0:
550+
print("[FAIL] Integration tests failed")
551+
sys.exit(1)
552+
553+
print("[OK] Integration tests passed")
554+
finally:
555+
if was_started:
556+
print("Stopping DemoApp...")
557+
stop_background()
558+
559+
print("")
560+
print("=" * 60)
561+
print("[OK] All tests passed!")
562+
print("=" * 60)
563+
508564
else:
509565
print(f"Unknown command: {command}")
510566
print_usage()
@@ -584,6 +640,7 @@ def print_usage() -> None:
584640
print(" test <filter> - Run tests matching filter")
585641
print(" test --filter <filter> - Run tests matching filter")
586642
print(" test-integration - Run Playwright integration tests (auto-starts DemoApp)")
643+
print(" test-all - Run all tests (unit + integration)")
587644
print("")
588645
print("Log Commands:")
589646
print(" log - Show last 50 lines of log")
@@ -599,6 +656,7 @@ def print_usage() -> None:
599656
print(" python build.py test # Run all unit tests")
600657
print(" python build.py test DebouncerTests # Run specific test class")
601658
print(" python build.py test-integration # Run E2E tests")
659+
print(" python build.py test-all # Run unit + integration tests")
602660
print(" python build.py log error # Search for 'error' in logs")
603661
print(" python build.py log --tail 100 --level warn")
604662

@@ -649,7 +707,7 @@ def main() -> None:
649707
print_usage()
650708
return
651709

652-
if command not in ["build", "watch", "run", "start", "pack", "publish", "test", "test-integration"]:
710+
if command not in ["build", "watch", "run", "start", "pack", "publish", "test", "test-integration", "test-all"]:
653711
print(f"Unknown command: {command}")
654712
print_usage()
655713
sys.exit(1)

0 commit comments

Comments
 (0)