\chapter{Estrategia de pruebas} \label{ch:estrategia} \section{Pir\'amide} \begin{table}[h] \centering \begin{tabular}{@{}llp{4.5cm}l@{}} \toprule \textbf{Capa} & \textbf{Qu\'e valida} & \textbf{D\'onde} & \textbf{Frecuencia} \\ \midrule Unitaria & Dominio, parsers, auth, store & Local + CI & Cada PR \\ Integraci\'on & HTTP + PG/Redis/MinIO & Compose test & PR / nightly \\ Contrato & OpenAPI / rutas gateway & CI & Cada PR \\ E2E & Flujos de negocio & Staging & Nightly / release \\ Estr\'es & L\'imites y degradaci\'on & Staging aislado & Pre-release \\ Chaos & Ca\'idas de dependencias & Staging & Mensual \\ \bottomrule \end{tabular} \caption{Pir\'amide de pruebas IPSExtractor.} \end{table} \section{Convenci\'on de identificadores} \begin{itemize} \item \texttt{UT--} --- unitarias \item \texttt{IT--} --- integraci\'on \item \texttt{E2E-} --- end-to-end de negocio \item \texttt{ST--} --- estr\'es / carga \item \texttt{CH-} --- chaos / resiliencia \end{itemize} \section{Entornos} \begin{description} \item[local] Mocks de LLM, Imaging y MinIO (moto/LocalStack). \item[ci] Unitarios + smoke Compose (\texttt{/health/live}). \item[staging] Stack completo + MinIO staging + LLM con cuota; Imaging solo con VPN de prueba. \item[stress] Igual que staging, sin usuarios reales; datos sint\'eticos. \end{description} \section{Mocks vs sistemas reales} \begin{table}[h] \centering \begin{tabular}{@{}lcccc@{}} \toprule \textbf{Dependencia} & \textbf{Unit/CI} & \textbf{Integr.} & \textbf{Estr\'es} & \textbf{E2E} \\ \midrule PostgreSQL & SQLite/TC & Real & Real & Real \\ Redis & Mock/TC & Real & Real & Real \\ MinIO & moto/LS & LocalStack & Staging & Staging \\ LLM & Fake HTTP & Fake & Fake+1 real & Real \\ Imaging & Mock & Mock & N/A & Real \\ Chrome & Mock & Mock & N/A & Real \\ \bottomrule \end{tabular} \caption{TC = Testcontainers; LS = LocalStack.} \end{table} \section{Principios} \begin{enumerate} \item Un caso = un objetivo verificable (assert expl\'icito). \item Datos de prueba versionados (fixtures), no datos de producci\'on. \item Estr\'es solo en staging aislado; umbrales escritos antes de ejecutar. \item Fallos externos (LLM/Imaging) se aislan con mocks en CI. \end{enumerate}