| name | cc1c-test-runner |
| description | Run and debug tests across all components: Go unit tests, Django tests, React tests, integration tests. Check coverage, analyze failures, suggest fixes. Use when user wants to run tests, check test coverage, debug test failures, or mentions testing, pytest, go test, jest. |
| allowed-tools | ["Bash","Read","Grep"] |
cc1c-test-runner
Purpose
Запускать и отлаживать тесты для всех компонентов проекта CommandCenter1C, обеспечивать требуемый coverage (> 70%) и помогать исправлять failing tests.
When to Use
Используй этот skill когда:
- Запуск тестов (любого типа: unit, integration, E2E)
- Проверка test coverage
- Debugging failed tests
- Анализ test results и улучшение coverage
- Пользователь упоминает: test, testing, pytest, go test, jest, coverage, failed, unittest
Quick Commands
Run All Tests
make test
make test-go
make test-django
make test-frontend
make test-coverage
make coverage-go
make coverage-django
Watch Mode (Development)
make test-watch
make test-watch-django
make test-watch-frontend
Coverage Requirements
⚠️ КРИТИЧНО: Coverage > 70% обязательно!
Component Target Coverage Priority
──────────────────────────────────────────────
Go Shared > 80% HIGH
Go API Gateway > 70% HIGH
Go Worker > 70% HIGH
Django Apps > 70% HIGH
React Components > 60% MEDIUM
Testing Strategy
Test Types
Unit Tests: Тестируют отдельные функции/классы
Integration Tests: Тестируют взаимодействие между компонентами
E2E Tests: Тестируют полный user flow (Phase 2+)
Load Tests: Тестируют производительность (Phase 5)
Go Tests
Quick Start
cd go-services
go test ./...
go test -v ./...
go test -cover ./...
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out
go test -run TestHandlerName ./api-gateway/internal/handlers
go test -race ./...
Детали: {baseDir}/reference/go-testing.md
Пример: {baseDir}/examples/go-test-example.go
Django Tests
Quick Start
cd orchestrator
python manage.py test
python manage.py test apps.operations
pytest --cov=apps --cov-report=html
python manage.py test --parallel
pytest --lf
pytest --ff
Детали: {baseDir}/reference/django-testing.md
Пример: {baseDir}/examples/django-test-example.py
React/Frontend Tests
Quick Start
cd frontend
npm test
npm test -- --watch
npm test -- --coverage
npm test -- OperationForm.test.tsx
npm test -- --watchAll=false
Детали: {baseDir}/reference/react-testing.md
Пример: {baseDir}/examples/react-test-example.tsx
Debugging Failed Tests
Quick Diagnosis
pytest --pdb
pytest -vv -s
go test -v ./...
go test -v -run TestMyFailingTest ./package
npm test -- --verbose
Common Failure Patterns
1. Intermittent failures (flaky tests)
- Причина: Race conditions, timing issues, shared state
- Решение: Wait for conditions, isolate state, fix race conditions
2. Database state issues
- Причина: Tests depend on order, shared database state
- Решение: Proper setUp/tearDown, use transactions
3. Mock issues
- Причина: Mock not applied correctly, wrong path
- Решение: Patch where used (not where defined), configure return values
Полный troubleshooting: {baseDir}/reference/debugging.md
Coverage Analysis
Checking Coverage
make coverage
make coverage-go
make coverage-django
make coverage-frontend
make coverage-report
Improving Coverage
1. Find uncovered code:
pytest --cov=apps --cov-report=term-missing | grep "0%"
go tool cover -func=coverage.out | grep "0.0%"
2. Write tests for uncovered code:
- Start with critical paths
- Then edge cases
- Then error handling
3. Verify improvement:
pytest --cov=apps
pytest --cov=apps
Integration Tests
Running Integration Tests
python manage.py test --tag=integration
go test -tags=integration ./...
python manage.py test --tag=integration --keepdb=False
Critical Constraints
- Coverage > 70% - обязательно для Go/Django, > 60% для React
- No Flaky Tests - все тесты должны быть стабильными (pass 100%)
- Fast Tests - unit tests < 1s, integration tests < 10s
- Isolated Tests - тесты НЕ зависят друг от друга или от порядка
- CI/CD Ready - тесты проходят в GitHub Actions (без ручных зависимостей)
Common Test Commands Cheatsheet
make test
make test-quick
make test-integration
make coverage
make coverage-report
make test-debug
make test-verbose
make test-watch
make test-go
make test-django
make test-frontend
References
Detailed Documentation
- {baseDir}/reference/go-testing.md - Go test patterns, coverage, debugging
- {baseDir}/reference/django-testing.md - Django/DRF test patterns
- {baseDir}/reference/react-testing.md - React Testing Library patterns
- {baseDir}/reference/debugging.md - отладка падающих тестов
Code Examples
- {baseDir}/examples/go-test-example.go - table-driven test pattern
- {baseDir}/examples/django-test-example.py - DRF ViewSet test
- {baseDir}/examples/react-test-example.tsx - React component test
Related Skills
cc1c-service-builder - для исправления failed tests
cc1c-navigator - для поиска связанного кода при debugging
cc1c-devops - для проверки окружения при integration test failures
Project Documentation
Version: 2.0 (Optimized)
Last Updated: 2025-11-06
Changelog:
- 2.0 (2025-11-06): Refactored to 180 lines, moved details to reference/ and examples/
- 1.0 (2025-01-17): Initial release with multi-language test support