Files
IPSExtractor/docs/plan_pruebas/sections/04_unitarias.tex
T

76 lines
2.9 KiB
TeX

\chapter{Pruebas unitarias}
\label{ch:unitarias}
\section{Gateway}
\begin{longtable}{@{}p{2.4cm}p{4.2cm}p{5.5cm}@{}}
\caption{Unitarias gateway.}\\
\toprule
\textbf{ID} & \textbf{Caso} & \textbf{Criterio de \'exito} \\
\midrule
\endhead
UT-GW-01 & Clasificaci\'on path upload vs JSON & Timeouts 600\,s vs 30\,s correctos \\
UT-GW-02 & Health live sin upstream & Respuesta inmediata \texttt{ok} \\
UT-GW-03 & Health agregado degradado & Si extraction/cleaning fallan $\rightarrow$ \texttt{degraded} \\
\bottomrule
\end{longtable}
\section{Bot-descarga API (\texttt{JobStore})}
Cobertura existente en \texttt{test\_store.py}; ampliar con:
\begin{longtable}{@{}p{2.6cm}p{4.0cm}p{5.5cm}@{}}
\caption{Unitarias bot-descarga API.}\\
\toprule
\textbf{ID} & \textbf{Caso} & \textbf{Criterio de \'exito} \\
\midrule
\endhead
UT-BOT-01 & Register + heartbeat & Worker online; offline tras $>$45\,s \\
UT-BOT-02 & Claim at\'omico & Un solo worker obtiene el job \\
UT-BOT-03 & Cancel pending & Estado \texttt{cancelled} inmediato \\
UT-BOT-04 & Cancel running & \texttt{cancel\_requested=true} \\
UT-BOT-05 & Auth Bearer & Token inv\'alido $\rightarrow$ 401 \\
UT-BOT-06 & Keys MinIO & Prefijos uploads/downloads correctos \\
\bottomrule
\end{longtable}
\section{Agent bot (PC)}
Mantener y extender \texttt{bots/bot\_descarga/tests/}:
\begin{longtable}{@{}p{2.6cm}p{4.0cm}p{5.5cm}@{}}
\caption{Unitarias agent.}\\
\toprule
\textbf{ID} & \textbf{Caso} & \textbf{Criterio de \'exito} \\
\midrule
\endhead
UT-AGT-01 & Excel reader / NIT & Headers y limpieza correctos \\
UT-AGT-02 & PDF validator & Rechaza firmas/pesos inv\'alidos \\
UT-AGT-03 & Cancel mid-run & \texttt{should\_cancel} detiene loop \\
UT-AGT-04 & Browser fatal DNS & \texttt{fatal\_error} en Imaging \\
UT-AGT-05 & MinIO keys & Keys y modo an\'onimo \\
UT-AGT-06 & RemoteApiClient (mock) & register/claim/events con HTTP fake \\
\bottomrule
\end{longtable}
\section{Extraction / Cleaning / Count / Desktop}
\begin{longtable}{@{}p{2.6cm}p{4.2cm}p{5.3cm}@{}}
\caption{Unitarias resto de servicios.}\\
\toprule
\textbf{ID} & \textbf{Caso} & \textbf{Criterio de \'exito} \\
\midrule
\endhead
UT-EXT-01 & Rate limiter LLM & Respeta RPM/TPM configurados \\
UT-EXT-02 & Normalizer JSON & Salida can\'onica estable \\
UT-CLN-01 & Reglas CSV & Numeric/text/special/dates \\
UT-CLN-02 & Type inference & Tipos coherentes con fixtures \\
UT-CNT-01 & Features ML & Vector de features esperado \\
UT-CNT-02 & PDF oversized & Rechazo controlado \\
UT-DES-01 & apiClient errores & Manejo de 4xx/5xx \\
UT-DES-02 & Wizard downloads & Payload job correcto \\
\bottomrule
\end{longtable}
\section{Comandos de ejecuci\'on}
\begin{lstlisting}[language=bash,caption={Suite unitaria r\'apida}]
cd bots/bot_descarga && python -m pytest tests/ -q
cd services/bot_descarga && pytest -q
cd services/desktop_app && npm test
cd services/services-count-facturas-medicas-serving && go test ./...
\end{lstlisting}