184 lines
3.7 KiB
Markdown
184 lines
3.7 KiB
Markdown
# TEST PLANS - ERP CONSTRUCCION
|
|
|
|
**Fecha:** 2025-11-25
|
|
**Basado en:** ADR-010 Testing Strategy
|
|
**Version:** 1.0.0
|
|
|
|
---
|
|
|
|
## Estrategia de Testing
|
|
|
|
Basado en ADR-010, el ERP Construccion implementa una estrategia de testing en piramide:
|
|
|
|
### Piramide de Testing
|
|
|
|
```
|
|
/\
|
|
/ \ E2E Tests (60% coverage)
|
|
/----\ - Flujos criticos completos
|
|
/ \ - Happy paths principales
|
|
/--------\ Integration Tests (70% coverage)
|
|
/ \ - APIs
|
|
/------------\ - Database
|
|
/ \ Unit Tests (80% coverage)
|
|
/----------------\ - Logica de negocio
|
|
- Validaciones
|
|
- Utilidades
|
|
```
|
|
|
|
### Objetivos de Cobertura
|
|
|
|
| Tipo de Test | Objetivo | Herramienta |
|
|
|--------------|----------|-------------|
|
|
| Unit Tests | 80% | Jest / Vitest |
|
|
| Integration Tests | 70% | Jest + Supertest |
|
|
| E2E Tests | 60% flujos criticos | Playwright |
|
|
|
|
---
|
|
|
|
## Estructura de Directorio
|
|
|
|
```
|
|
04-test-plans/
|
|
+-- README.md (este archivo)
|
|
+-- PLAN-PRUEBAS-GENERAL.md
|
|
+-- PLAN-PRUEBAS-INTEGRACION.md
|
|
+-- PLAN-PRUEBAS-E2E.md
|
|
+-- MATRIZ-CASOS-PRUEBA.md
|
|
+-- modulos/
|
|
| +-- TEST-PLAN-MAI-001.md
|
|
| +-- TEST-PLAN-MAI-002.md
|
|
| +-- ...
|
|
```
|
|
|
|
---
|
|
|
|
## Plan General de Pruebas
|
|
|
|
### Fase 1: Unit Tests (Backend)
|
|
|
|
**Prioridad:** P0
|
|
**Cobertura objetivo:** 80%
|
|
|
|
**Modulos criticos:**
|
|
1. MAI-001 - Autenticacion y RBAC
|
|
2. MAI-003 - Calculos de presupuesto
|
|
3. MAI-008 - Calculos de estimaciones
|
|
|
|
**Casos de prueba:**
|
|
- Validaciones de entrada
|
|
- Logica de calculos
|
|
- Transformaciones de datos
|
|
- Funciones utilitarias
|
|
|
|
### Fase 2: Integration Tests
|
|
|
|
**Prioridad:** P0
|
|
**Cobertura objetivo:** 70%
|
|
|
|
**Modulos criticos:**
|
|
1. MAI-001 - Auth endpoints
|
|
2. MAI-002 - CRUD Proyectos
|
|
3. MAI-004 - Flujo de requisiciones
|
|
4. MAI-005 - Captura de avances
|
|
5. MAI-008 - Workflow estimaciones
|
|
|
|
**Casos de prueba:**
|
|
- APIs CRUD
|
|
- Validaciones de negocio
|
|
- RLS policies
|
|
- Workflows de estado
|
|
|
|
### Fase 3: E2E Tests
|
|
|
|
**Prioridad:** P1
|
|
**Cobertura objetivo:** 60% flujos criticos
|
|
|
|
**Flujos criticos:**
|
|
1. Login -> Dashboard -> Logout
|
|
2. Crear fraccionamiento -> Etapas -> Lotes
|
|
3. Crear presupuesto -> Asignar a prototipo
|
|
4. Requisicion -> Aprobar -> OC -> Recibir
|
|
5. Capturar avance -> Aprobar -> Estimacion
|
|
6. Estimacion -> Workflow -> Aprobar
|
|
|
|
---
|
|
|
|
## Criterios de Aceptacion
|
|
|
|
### Para Unit Tests
|
|
- [ ] Cobertura >= 80%
|
|
- [ ] Todos los tests pasan
|
|
- [ ] Sin mocks excesivos
|
|
- [ ] Tests aislados
|
|
|
|
### Para Integration Tests
|
|
- [ ] Cobertura >= 70%
|
|
- [ ] Database real (test)
|
|
- [ ] Cleanup despues de cada test
|
|
- [ ] Tests independientes
|
|
|
|
### Para E2E Tests
|
|
- [ ] Flujos criticos cubiertos
|
|
- [ ] Screenshots en fallas
|
|
- [ ] Tiempos de respuesta < 3s
|
|
- [ ] Multi-browser (Chrome, Firefox)
|
|
|
|
---
|
|
|
|
## Herramientas
|
|
|
|
### Backend
|
|
- **Jest:** Framework de testing
|
|
- **Supertest:** Testing de APIs
|
|
- **Faker.js:** Generacion de datos
|
|
- **TestContainers:** PostgreSQL para tests
|
|
|
|
### Frontend
|
|
- **Vitest:** Unit tests
|
|
- **React Testing Library:** Componentes
|
|
- **MSW:** Mock de APIs
|
|
- **Playwright:** E2E tests
|
|
|
|
### CI/CD
|
|
- **GitHub Actions:** Pipeline de CI
|
|
- **Coverage Reports:** Codecov / SonarQube
|
|
|
|
---
|
|
|
|
## Ambiente de Testing
|
|
|
|
```yaml
|
|
test_environment:
|
|
database: PostgreSQL (TestContainers o dedicada)
|
|
redis: Redis (mock o TestContainers)
|
|
storage: LocalStorage mock
|
|
external_apis: MSW mocks
|
|
|
|
test_data:
|
|
seeds: /database/seeds/test/
|
|
factories: /src/test/factories/
|
|
```
|
|
|
|
---
|
|
|
|
## Proximos Pasos
|
|
|
|
1. [ ] Crear TEST-PLAN-MAI-001.md a MAI-013
|
|
2. [ ] Definir casos de prueba por modulo
|
|
3. [ ] Configurar Jest/Vitest
|
|
4. [ ] Configurar Playwright
|
|
5. [ ] Configurar CI pipeline
|
|
|
|
---
|
|
|
|
## Referencias
|
|
|
|
- [ADR-010: Testing Strategy](../adr/ADR-010-testing-strategy.md)
|
|
- [ERP Generico - Test Plans](/projects/erp-generic/docs/04-test-plans/)
|
|
|
|
---
|
|
|
|
**Ultima actualizacion:** 2025-11-25
|
|
**Version:** 1.0.0
|