erp-core/docs/06-test-plans/README.md

343 lines
10 KiB
Markdown

# TEST PLANS - ERP GENÉRICO
**Fecha:** 2025-11-24
**Versión:** 1.0
**Estado:** ✅ Completado
**Total Test Plans:** 15 archivos
---
## Resumen Ejecutivo
Este directorio contiene la **estrategia completa de testing** para el ERP Genérico, un sistema modular de 14 módulos que servirá como base para 3 ERPs especializados.
La estrategia incluye:
- **1 Master Test Plan:** Estrategia global, herramientas, ambientes, roles, métricas
- **14 Test Plans Modulares:** Uno por cada módulo (MGN-001 a MGN-014)
- **Total estimado:** ~1,461 tests (876 unit, 438 integration, 147 E2E)
---
## Índice de Test Plans
### Master Test Plan
| Archivo | Descripción | Tamaño |
|---------|-------------|--------|
| [MASTER-TEST-PLAN.md](./MASTER-TEST-PLAN.md) | Estrategia global de testing para el proyecto completo | 29 KB |
**Contenido del Master Test Plan:**
1. Introducción (propósito, alcance, objetivos de calidad)
2. Estrategia de Testing (testing pyramid, tipos de testing, niveles)
3. Ambientes de Testing (Development, CI/CD, QA, Staging, Production)
4. Test Cases por Módulo (resumen de 1,461 tests)
5. Schedule de Testing (34 sprints, 68 semanas)
6. Criterios de Entrada/Salida (Entry/Exit criteria, DoR/DoD)
7. Herramientas (Jest, Vitest, Playwright, k6, OWASP ZAP, Snyk, etc.)
8. Riesgos y Mitigaciones
9. Métricas y Reportes (KPIs, dashboards, reportes)
10. Roles y Responsabilidades
---
## Test Plans por Módulo
### Core Modules (P0 - MVP)
| Módulo | Archivo | US | Tests | SP | Prioridad | Sprints |
|--------|---------|-----|-------|-----|-----------|---------|
| MGN-001: Fundamentos | [TEST-PLAN-MGN-001-fundamentos.md](./TEST-PLAN-MGN-001-fundamentos.md) | 16 | 160 | 68 | P0 | 1-5 |
| MGN-002: Empresas | [TEST-PLAN-MGN-002-empresas.md](./TEST-PLAN-MGN-002-empresas.md) | 7 | 70 | 34 | P0 | 3-7 |
| MGN-003: Catálogos | [TEST-PLAN-MGN-003-catalogos.md](./TEST-PLAN-MGN-003-catalogos.md) | 8 | 80 | 29 | P0 | 5-6 |
| MGN-004: Financiero | [TEST-PLAN-MGN-004-financiero.md](./TEST-PLAN-MGN-004-financiero.md) | 18 | 180 | 81 | P0 | 7-11 |
| MGN-005: Inventario | [TEST-PLAN-MGN-005-inventario.md](./TEST-PLAN-MGN-005-inventario.md) | 14 | 140 | 66 | P0 | 12-15 |
| MGN-006: Compras | [TEST-PLAN-MGN-006-compras.md](./TEST-PLAN-MGN-006-compras.md) | 12 | 120 | 42 | P0/P1 | 16-18 |
| MGN-007: Ventas | [TEST-PLAN-MGN-007-ventas.md](./TEST-PLAN-MGN-007-ventas.md) | 12 | 120 | 45 | P0 | 19-21 |
| MGN-008: Analítica | [TEST-PLAN-MGN-008-analitica.md](./TEST-PLAN-MGN-008-analitica.md) | 10 | 100 | 35 | P0 | 22-23 |
| MGN-014: Mensajería | [TEST-PLAN-MGN-014-mensajeria.md](./TEST-PLAN-MGN-014-mensajeria.md) | 12 | 120 | 47 | P0 | 33-34 |
**Subtotal Core:** 109 US, 1,090 tests, 447 SP
---
### Complementary Modules (P1 - Post-MVP)
| Módulo | Archivo | US | Tests | SP | Prioridad | Sprints |
|--------|---------|-----|-------|-----|-----------|---------|
| MGN-009: CRM | [TEST-PLAN-MGN-009-crm.md](./TEST-PLAN-MGN-009-crm.md) | 8 | 80 | 31 | P1 | 24-25 |
| MGN-010: RRHH | [TEST-PLAN-MGN-010-rrhh.md](./TEST-PLAN-MGN-010-rrhh.md) | 7 | 70 | 29 | P1 | 26-27 |
| MGN-011: Proyectos | [TEST-PLAN-MGN-011-proyectos.md](./TEST-PLAN-MGN-011-proyectos.md) | 10 | 100 | 40 | P1 | 28-29 |
| MGN-012: Reportes | [TEST-PLAN-MGN-012-reportes.md](./TEST-PLAN-MGN-012-reportes.md) | 6 | 60 | 39 | P1 | 30-31 |
| MGN-013: Portal | [TEST-PLAN-MGN-013-portal.md](./TEST-PLAN-MGN-013-portal.md) | 6 | 60 | 29 | P1 | 32 |
**Subtotal Complementary:** 37 US, 370 tests, 168 SP
---
## Resumen de Testing
### Métricas Globales
| Métrica | Valor | Objetivo |
|---------|-------|----------|
| **Total Módulos** | 14 | - |
| **Total User Stories** | 147 | - |
| **Total Story Points** | 673 SP | - |
| **Total Tests Estimados** | 1,461 | - |
| **Unit Tests** | 876 (60%) | >80% coverage |
| **Integration Tests** | 438 (30%) | 100% endpoints |
| **E2E Tests** | 147 (10%) | Flujos críticos |
### Distribución de Tests por Tipo
**Unit Tests (876):**
- Backend services: 350 tests (40%)
- Backend controllers: 175 tests (20%)
- Backend helpers/utils: 131 tests (15%)
- Frontend components: 131 tests (15%)
- Frontend hooks: 89 tests (10%)
**Integration Tests (438):**
- API endpoints: 263 tests (60%)
- Database transactions: 88 tests (20%)
- Component + API: 66 tests (15%)
- State management: 21 tests (5%)
**E2E Tests (147):**
- Happy paths: 88 tests (60%)
- Error paths: 37 tests (25%)
- Edge cases: 22 tests (15%)
### Timeline
- **Duración total:** 34 sprints (68 semanas)
- **MVP Release:** Sprint 23 (Semana 46) - 970 tests
- **Full Release:** Sprint 34 (Semana 68) - 1,461 tests
---
## Estructura de un Test Plan Modular
Cada Test Plan de módulo sigue esta estructura estandarizada:
```markdown
1. RESUMEN DEL MÓDULO
- Descripción
- Funcionalidades principales
- Dependencias
2. ALCANCE DEL TESTING
- En alcance
- Fuera de alcance
- Assumptions
3. ESTRATEGIA DE TESTING
- Unit tests (backend + frontend)
- Integration tests (API + DB)
- E2E tests (user journeys)
4. TEST CASES
- Funcionales (críticos priorizados)
- No funcionales (performance, security)
5. DATOS DE PRUEBA
- Test data requirements
- Seed scripts
6. AMBIENTE DE TESTING
- Configuración (DB, backend, frontend)
- URLs
- Environment variables
7. SCHEDULE
- Timeline por sprint
- Actividades y responsables
8. ENTRY/EXIT CRITERIA
- Entry criteria
- Exit criteria
- DoR / DoD
9. DEFECT MANAGEMENT
- Severidad de bugs (P0-P3)
- Bug report template
- SLAs
10. RIESGOS ESPECÍFICOS
- Riesgos identificados
- Probabilidad e impacto
- Mitigaciones
11. MÉTRICAS
- Test execution metrics
- Defect metrics
- Coverage metrics
12. SIGN-OFF
- Approvals (QA, Tech Lead, PO)
13. REFERENCIAS
- Links a US, RFs, ETs, Traceability
```
---
## Herramientas de Testing
### Testing Frameworks
**Backend:**
- Jest: Unit tests
- Supertest: API integration tests
- TestContainers: Database integration tests
**Frontend:**
- Vitest: Unit tests
- React Testing Library: Component tests
- Playwright: E2E tests
**API:**
- Postman/Newman: Contract testing
**Performance:**
- k6: Load testing
**Security:**
- OWASP ZAP: DAST
- Snyk: SAST + dependency scanning
### CI/CD
**Pipeline:** GitHub Actions
**Stages:**
1. Build (compile TypeScript)
2. Lint (ESLint + Prettier)
3. Unit Tests (<2 min)
4. Integration Tests (<10 min)
5. Security Scan (Snyk + npm audit)
6. Code Coverage (Codecov)
7. Quality Gate (SonarQube >80% coverage)
8. E2E Tests (nightly builds)
9. Deploy to QA (auto if all pass)
---
## Ambientes de Testing
| Ambiente | Propósito | Deploy | Data | URL |
|----------|-----------|--------|------|-----|
| **Development** | Dev local | Manual | Fixtures | http://localhost:3000 |
| **CI/CD** | Tests automáticos | Auto (PR) | Seeded | - |
| **QA** | Testing manual | Auto (develop) | Anonymized prod | https://qa.erp.local |
| **Staging** | Pre-producción | Manual | Prod clone | https://staging.erp.com |
| **Production** | Producción | Manual | Real | https://erp.com |
---
## Criterios de Calidad
### Coverage Objectives
- **Code coverage:** >80% (backend y frontend)
- **API endpoint coverage:** 100%
- **E2E coverage:** 100% flujos críticos
- **Automated tests:** >70%
### Quality Gates (SonarQube)
- Coverage: >80% (bloqueante)
- Duplicated code: <3%
- Code smells: <10 per 1000 LOC
- Bugs: 0 critical, 0 major
- Vulnerabilities: 0 critical, 0 major
### Performance Targets
- **Response time:** <300ms (p95) para APIs
- **Page load time:** <2s (p95) para frontend
- **Throughput:** >1000 req/s en peak load
- **Error rate:** <1% en peak load
---
## Roles y Responsabilidades
| Rol | Responsabilidades |
|-----|-------------------|
| **QA Lead** | Estrategia de testing, coordinación, reportes, quality gates |
| **QA Engineer** | Crear test cases, ejecutar testing manual, escribir E2E tests |
| **Developer** | Escribir unit e integration tests, resolver bugs |
| **Tech Lead** | Code review, architecture decisions, quality gates |
| **Product Owner** | Definir criterios de aceptación, UAT, Go/No-Go decisions |
| **DevOps** | CI/CD pipeline, ambientes, monitoring |
---
## Próximos Pasos
### Inmediato (Sprint 1)
1. **Aprobar Master Test Plan:** Revisión y sign-off por QA Lead, Tech Lead, PO
2. **Setup de Ambientes:** Configurar QA, CI/CD, test data
3. **Setup de Herramientas:** Jest, Vitest, Playwright, k6, OWASP ZAP
4. **Kickoff Sprint 1:** Iniciar implementación de MGN-001 (Fundamentos)
### Corto Plazo (Sprint 1-5)
5. **Implementar MGN-001:** Auth, users, roles, multi-tenancy con testing completo
6. **Establecer Baselines:** Performance baselines, coverage baselines
7. **CI/CD Pipeline:** Configurar GitHub Actions con quality gates
8. **Documentar Lecciones:** Retrospectives, ajustes a test plans
### Mediano Plazo (Sprint 6-23)
9. **MVP Release:** Completar módulos P0 (MGN-001 a MGN-008 + MGN-014)
10. **Performance Testing:** Load testing con k6 en staging
11. **Security Audit:** Penetration testing externo
12. **UAT:** User Acceptance Testing con stakeholders
### Largo Plazo (Sprint 24-34)
13. **Post-MVP:** Completar módulos P1 (MGN-009 a MGN-013)
14. **Full Release:** Release completo con 1,461 tests pasando
15. **Production Monitoring:** Setup de APM, alertas, dashboards
16. **Continuous Improvement:** Refactor tests, optimizar suite, mantener coverage
---
## Referencias
**Documentación del Proyecto:**
- [User Stories](../03-user-stories/)
- [Requerimientos Funcionales](../02-modelado/requerimientos-funcionales/)
- [Especificaciones Técnicas Backend](../02-modelado/especificaciones-tecnicas/backend/)
- [Especificaciones Técnicas Frontend](../02-modelado/especificaciones-tecnicas/frontend/)
- [Matrices de Trazabilidad](../02-modelado/trazabilidad/)
**ADRs (Architecture Decision Records):**
- [ADR-010: Testing Strategy](../adr/ADR-010-testing-strategy.md)
**Referencias Externas:**
- [OWASP Top 10](https://owasp.org/www-project-top-ten/)
- [WCAG 2.1 Guidelines](https://www.w3.org/WAI/WCAG21/quickref/)
- [Testing Library Best Practices](https://kentcdodds.com/blog/common-mistakes-with-react-testing-library)
- [Playwright Best Practices](https://playwright.dev/docs/best-practices)
- [Jest Best Practices](https://github.com/goldbergyoni/javascript-testing-best-practices)
---
## Equipo
**QA Architect / Test Strategy Lead:** TBD
**Fecha de Creación:** 2025-11-24
**Estado:** Completado (15/15 Test Plans)
**Próxima Revisión:** Sprint 1 Kickoff
---
**Documento:** README.md
**Versión:** 1.0
**Fecha:** 2025-11-24
**Estado:** Completado