agentic-qe 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (338) hide show
  1. package/.claude/settings.json +44 -6
  2. package/.claude/skills/accessibility-testing/SKILL.md +777 -0
  3. package/.claude/skills/chaos-engineering-resilience/SKILL.md +109 -0
  4. package/.claude/skills/compatibility-testing/SKILL.md +101 -0
  5. package/.claude/skills/compliance-testing/SKILL.md +162 -0
  6. package/.claude/skills/contract-testing/SKILL.md +193 -0
  7. package/.claude/skills/database-testing/SKILL.md +243 -0
  8. package/.claude/skills/localization-testing/SKILL.md +115 -0
  9. package/.claude/skills/mobile-testing/SKILL.md +548 -0
  10. package/.claude/skills/mutation-testing/SKILL.md +129 -0
  11. package/.claude/skills/regression-testing/SKILL.md +1045 -0
  12. package/.claude/skills/shift-left-testing/SKILL.md +535 -0
  13. package/.claude/skills/shift-right-testing/SKILL.md +591 -0
  14. package/.claude/skills/test-data-management/SKILL.md +1067 -0
  15. package/.claude/skills/test-design-techniques/SKILL.md +160 -0
  16. package/.claude/skills/test-environment-management/SKILL.md +204 -0
  17. package/.claude/skills/test-reporting-analytics/SKILL.md +143 -0
  18. package/.claude/skills/visual-testing-advanced/SKILL.md +148 -0
  19. package/CHANGELOG.md +88 -6
  20. package/README.md +15 -8
  21. package/dist/agents/BaseAgent.d.ts.map +1 -1
  22. package/dist/agents/BaseAgent.js +5 -4
  23. package/dist/agents/BaseAgent.js.map +1 -1
  24. package/dist/agents/CoverageAnalyzerAgent.d.ts.map +1 -1
  25. package/dist/agents/CoverageAnalyzerAgent.js +9 -8
  26. package/dist/agents/CoverageAnalyzerAgent.js.map +1 -1
  27. package/dist/agents/FlakyTestHunterAgent.d.ts.map +1 -1
  28. package/dist/agents/FlakyTestHunterAgent.js +3 -2
  29. package/dist/agents/FlakyTestHunterAgent.js.map +1 -1
  30. package/dist/agents/FleetCommanderAgent.d.ts.map +1 -1
  31. package/dist/agents/FleetCommanderAgent.js +2 -1
  32. package/dist/agents/FleetCommanderAgent.js.map +1 -1
  33. package/dist/agents/PerformanceTesterAgent.d.ts.map +1 -1
  34. package/dist/agents/PerformanceTesterAgent.js +7 -6
  35. package/dist/agents/PerformanceTesterAgent.js.map +1 -1
  36. package/dist/agents/ProductionIntelligenceAgent.d.ts.map +1 -1
  37. package/dist/agents/ProductionIntelligenceAgent.js +7 -6
  38. package/dist/agents/ProductionIntelligenceAgent.js.map +1 -1
  39. package/dist/agents/QualityAnalyzerAgent.d.ts.map +1 -1
  40. package/dist/agents/QualityAnalyzerAgent.js +37 -36
  41. package/dist/agents/QualityAnalyzerAgent.js.map +1 -1
  42. package/dist/agents/QualityGateAgent.d.ts.map +1 -1
  43. package/dist/agents/QualityGateAgent.js +2 -1
  44. package/dist/agents/QualityGateAgent.js.map +1 -1
  45. package/dist/agents/RegressionRiskAnalyzerAgent.d.ts.map +1 -1
  46. package/dist/agents/RegressionRiskAnalyzerAgent.js +15 -14
  47. package/dist/agents/RegressionRiskAnalyzerAgent.js.map +1 -1
  48. package/dist/agents/SecurityScannerAgent.d.ts.map +1 -1
  49. package/dist/agents/SecurityScannerAgent.js +2 -1
  50. package/dist/agents/SecurityScannerAgent.js.map +1 -1
  51. package/dist/agents/TestDataArchitectAgent.d.ts.map +1 -1
  52. package/dist/agents/TestDataArchitectAgent.js +12 -11
  53. package/dist/agents/TestDataArchitectAgent.js.map +1 -1
  54. package/dist/agents/TestExecutorAgent.d.ts.map +1 -1
  55. package/dist/agents/TestExecutorAgent.js +17 -16
  56. package/dist/agents/TestExecutorAgent.js.map +1 -1
  57. package/dist/agents/TestGeneratorAgent.d.ts.map +1 -1
  58. package/dist/agents/TestGeneratorAgent.js +10 -9
  59. package/dist/agents/TestGeneratorAgent.js.map +1 -1
  60. package/dist/agents/index.d.ts.map +1 -1
  61. package/dist/agents/index.js +2 -1
  62. package/dist/agents/index.js.map +1 -1
  63. package/dist/cli/commands/agent/benchmark.d.ts.map +1 -1
  64. package/dist/cli/commands/agent/benchmark.js +2 -1
  65. package/dist/cli/commands/agent/benchmark.js.map +1 -1
  66. package/dist/cli/commands/agent/spawn.d.ts.map +1 -1
  67. package/dist/cli/commands/agent/spawn.js +2 -1
  68. package/dist/cli/commands/agent/spawn.js.map +1 -1
  69. package/dist/cli/commands/analyze.d.ts.map +1 -1
  70. package/dist/cli/commands/analyze.js +2 -1
  71. package/dist/cli/commands/analyze.js.map +1 -1
  72. package/dist/cli/commands/config/list.d.ts.map +1 -1
  73. package/dist/cli/commands/config/list.js +2 -1
  74. package/dist/cli/commands/config/list.js.map +1 -1
  75. package/dist/cli/commands/config/set.d.ts +7 -0
  76. package/dist/cli/commands/config/set.d.ts.map +1 -1
  77. package/dist/cli/commands/config/set.js +35 -4
  78. package/dist/cli/commands/config/set.js.map +1 -1
  79. package/dist/cli/commands/fleet/logs.d.ts.map +1 -1
  80. package/dist/cli/commands/fleet/logs.js +2 -1
  81. package/dist/cli/commands/fleet/logs.js.map +1 -1
  82. package/dist/cli/commands/fleet/metrics.d.ts.map +1 -1
  83. package/dist/cli/commands/fleet/metrics.js +2 -1
  84. package/dist/cli/commands/fleet/metrics.js.map +1 -1
  85. package/dist/cli/commands/fleet/monitor.d.ts.map +1 -1
  86. package/dist/cli/commands/fleet/monitor.js +7 -5
  87. package/dist/cli/commands/fleet/monitor.js.map +1 -1
  88. package/dist/cli/commands/fleet.d.ts.map +1 -1
  89. package/dist/cli/commands/fleet.js +2 -1
  90. package/dist/cli/commands/fleet.js.map +1 -1
  91. package/dist/cli/commands/generate.d.ts.map +1 -1
  92. package/dist/cli/commands/generate.js +2 -1
  93. package/dist/cli/commands/generate.js.map +1 -1
  94. package/dist/cli/commands/improve/index.d.ts.map +1 -1
  95. package/dist/cli/commands/improve/index.js +12 -11
  96. package/dist/cli/commands/improve/index.js.map +1 -1
  97. package/dist/cli/commands/init.d.ts +1 -1
  98. package/dist/cli/commands/init.d.ts.map +1 -1
  99. package/dist/cli/commands/init.js +40 -16
  100. package/dist/cli/commands/init.js.map +1 -1
  101. package/dist/cli/commands/learn/index.d.ts.map +1 -1
  102. package/dist/cli/commands/learn/index.js +13 -12
  103. package/dist/cli/commands/learn/index.js.map +1 -1
  104. package/dist/cli/commands/monitor/alerts.d.ts.map +1 -1
  105. package/dist/cli/commands/monitor/alerts.js +2 -1
  106. package/dist/cli/commands/monitor/alerts.js.map +1 -1
  107. package/dist/cli/commands/patterns/index.d.ts.map +1 -1
  108. package/dist/cli/commands/patterns/index.js +20 -19
  109. package/dist/cli/commands/patterns/index.js.map +1 -1
  110. package/dist/cli/commands/quality/decision.d.ts.map +1 -1
  111. package/dist/cli/commands/quality/decision.js +9 -7
  112. package/dist/cli/commands/quality/decision.js.map +1 -1
  113. package/dist/cli/commands/quality/gate.d.ts.map +1 -1
  114. package/dist/cli/commands/quality/gate.js +10 -8
  115. package/dist/cli/commands/quality/gate.js.map +1 -1
  116. package/dist/cli/commands/quality/policy.d.ts.map +1 -1
  117. package/dist/cli/commands/quality/policy.js +10 -8
  118. package/dist/cli/commands/quality/policy.js.map +1 -1
  119. package/dist/cli/commands/quality/risk.d.ts.map +1 -1
  120. package/dist/cli/commands/quality/risk.js +5 -3
  121. package/dist/cli/commands/quality/risk.js.map +1 -1
  122. package/dist/cli/commands/quality/validate.d.ts.map +1 -1
  123. package/dist/cli/commands/quality/validate.js +10 -8
  124. package/dist/cli/commands/quality/validate.js.map +1 -1
  125. package/dist/cli/commands/quantization.d.ts +6 -0
  126. package/dist/cli/commands/quantization.d.ts.map +1 -0
  127. package/dist/cli/commands/quantization.js +188 -0
  128. package/dist/cli/commands/quantization.js.map +1 -0
  129. package/dist/cli/commands/routing/index.d.ts +0 -6
  130. package/dist/cli/commands/routing/index.d.ts.map +1 -1
  131. package/dist/cli/commands/routing/index.js +17 -16
  132. package/dist/cli/commands/routing/index.js.map +1 -1
  133. package/dist/cli/commands/run.d.ts.map +1 -1
  134. package/dist/cli/commands/run.js +2 -1
  135. package/dist/cli/commands/run.js.map +1 -1
  136. package/dist/cli/commands/skills/index.d.ts.map +1 -1
  137. package/dist/cli/commands/skills/index.js +10 -9
  138. package/dist/cli/commands/skills/index.js.map +1 -1
  139. package/dist/cli/commands/test/debug.d.ts.map +1 -1
  140. package/dist/cli/commands/test/debug.js +2 -1
  141. package/dist/cli/commands/test/debug.js.map +1 -1
  142. package/dist/cli/commands/test/mutate.d.ts.map +1 -1
  143. package/dist/cli/commands/test/mutate.js +2 -1
  144. package/dist/cli/commands/test/mutate.js.map +1 -1
  145. package/dist/cli/commands/test/parallel.d.ts.map +1 -1
  146. package/dist/cli/commands/test/parallel.js +6 -4
  147. package/dist/cli/commands/test/parallel.js.map +1 -1
  148. package/dist/cli/commands/test/profile.d.ts.map +1 -1
  149. package/dist/cli/commands/test/profile.js +3 -2
  150. package/dist/cli/commands/test/profile.js.map +1 -1
  151. package/dist/cli/commands/test/queue.d.ts.map +1 -1
  152. package/dist/cli/commands/test/queue.js +2 -1
  153. package/dist/cli/commands/test/queue.js.map +1 -1
  154. package/dist/cli/commands/test/retry.d.ts.map +1 -1
  155. package/dist/cli/commands/test/retry.js +6 -4
  156. package/dist/cli/commands/test/retry.js.map +1 -1
  157. package/dist/cli/commands/test/trace.d.ts.map +1 -1
  158. package/dist/cli/commands/test/trace.js +2 -1
  159. package/dist/cli/commands/test/trace.js.map +1 -1
  160. package/dist/cli/commands/test/watch.d.ts.map +1 -1
  161. package/dist/cli/commands/test/watch.js +3 -2
  162. package/dist/cli/commands/test/watch.js.map +1 -1
  163. package/dist/cli/commands/workflow/cancel.d.ts.map +1 -1
  164. package/dist/cli/commands/workflow/cancel.js +2 -1
  165. package/dist/cli/commands/workflow/cancel.js.map +1 -1
  166. package/dist/cli/index-working.js +9 -8
  167. package/dist/cli/index-working.js.map +1 -1
  168. package/dist/cli/index.js +5 -0
  169. package/dist/cli/index.js.map +1 -1
  170. package/dist/core/coordination/OODACoordination.d.ts.map +1 -1
  171. package/dist/core/coordination/OODACoordination.js +2 -1
  172. package/dist/core/coordination/OODACoordination.js.map +1 -1
  173. package/dist/core/memory/AgentDBManager.d.ts.map +1 -1
  174. package/dist/core/memory/AgentDBManager.js +2 -19
  175. package/dist/core/memory/AgentDBManager.js.map +1 -1
  176. package/dist/core/memory/RealAgentDBAdapter.d.ts.map +1 -1
  177. package/dist/core/memory/RealAgentDBAdapter.js +4 -3
  178. package/dist/core/memory/RealAgentDBAdapter.js.map +1 -1
  179. package/dist/core/memory/ReasoningBankAdapter.d.ts.map +1 -1
  180. package/dist/core/memory/ReasoningBankAdapter.js +2 -5
  181. package/dist/core/memory/ReasoningBankAdapter.js.map +1 -1
  182. package/dist/core/memory/SwarmMemoryManager.d.ts.map +1 -1
  183. package/dist/core/memory/SwarmMemoryManager.js +4 -3
  184. package/dist/core/memory/SwarmMemoryManager.js.map +1 -1
  185. package/dist/core/neural/NeuralTrainer.d.ts.map +1 -1
  186. package/dist/core/neural/NeuralTrainer.js +3 -2
  187. package/dist/core/neural/NeuralTrainer.js.map +1 -1
  188. package/dist/core/quantization/QuantizationManager.d.ts +83 -0
  189. package/dist/core/quantization/QuantizationManager.d.ts.map +1 -0
  190. package/dist/core/quantization/QuantizationManager.js +264 -0
  191. package/dist/core/quantization/QuantizationManager.js.map +1 -0
  192. package/dist/core/quantization/index.d.ts +5 -0
  193. package/dist/core/quantization/index.d.ts.map +1 -0
  194. package/dist/core/quantization/index.js +9 -0
  195. package/dist/core/quantization/index.js.map +1 -0
  196. package/dist/mcp/handlers/advanced/mutation-test-execute.d.ts +3 -3
  197. package/dist/mcp/handlers/advanced/mutation-test-execute.d.ts.map +1 -1
  198. package/dist/mcp/handlers/advanced/mutation-test-execute.js +5 -4
  199. package/dist/mcp/handlers/advanced/mutation-test-execute.js.map +1 -1
  200. package/dist/mcp/handlers/agent-spawn.d.ts.map +1 -1
  201. package/dist/mcp/handlers/agent-spawn.js +2 -1
  202. package/dist/mcp/handlers/agent-spawn.js.map +1 -1
  203. package/dist/mcp/handlers/analysis/coverageAnalyzeSublinear.d.ts.map +1 -1
  204. package/dist/mcp/handlers/analysis/coverageAnalyzeSublinear.js +9 -8
  205. package/dist/mcp/handlers/analysis/coverageAnalyzeSublinear.js.map +1 -1
  206. package/dist/mcp/handlers/analysis/coverageGapsDetect.d.ts.map +1 -1
  207. package/dist/mcp/handlers/analysis/coverageGapsDetect.js +6 -5
  208. package/dist/mcp/handlers/analysis/coverageGapsDetect.js.map +1 -1
  209. package/dist/mcp/handlers/analysis/performance-monitor-realtime-handler.d.ts.map +1 -1
  210. package/dist/mcp/handlers/analysis/performance-monitor-realtime-handler.js +5 -4
  211. package/dist/mcp/handlers/analysis/performance-monitor-realtime-handler.js.map +1 -1
  212. package/dist/mcp/handlers/analysis/performanceBenchmarkRun.d.ts.map +1 -1
  213. package/dist/mcp/handlers/analysis/performanceBenchmarkRun.js +8 -7
  214. package/dist/mcp/handlers/analysis/performanceBenchmarkRun.js.map +1 -1
  215. package/dist/mcp/handlers/analysis/performanceMonitorRealtime.d.ts.map +1 -1
  216. package/dist/mcp/handlers/analysis/performanceMonitorRealtime.js +7 -6
  217. package/dist/mcp/handlers/analysis/performanceMonitorRealtime.js.map +1 -1
  218. package/dist/mcp/handlers/analysis/securityScanComprehensive.d.ts.map +1 -1
  219. package/dist/mcp/handlers/analysis/securityScanComprehensive.js +18 -21
  220. package/dist/mcp/handlers/analysis/securityScanComprehensive.js.map +1 -1
  221. package/dist/mcp/handlers/base-handler.d.ts.map +1 -1
  222. package/dist/mcp/handlers/base-handler.js +2 -9
  223. package/dist/mcp/handlers/base-handler.js.map +1 -1
  224. package/dist/mcp/handlers/chaos/chaos-inject-failure.d.ts.map +1 -1
  225. package/dist/mcp/handlers/chaos/chaos-inject-failure.js +4 -3
  226. package/dist/mcp/handlers/chaos/chaos-inject-failure.js.map +1 -1
  227. package/dist/mcp/handlers/chaos/chaos-inject-latency.d.ts.map +1 -1
  228. package/dist/mcp/handlers/chaos/chaos-inject-latency.js +6 -5
  229. package/dist/mcp/handlers/chaos/chaos-inject-latency.js.map +1 -1
  230. package/dist/mcp/handlers/coordination/event-emit.d.ts.map +1 -1
  231. package/dist/mcp/handlers/coordination/event-emit.js +2 -1
  232. package/dist/mcp/handlers/coordination/event-emit.js.map +1 -1
  233. package/dist/mcp/handlers/coordination/event-subscribe.d.ts.map +1 -1
  234. package/dist/mcp/handlers/coordination/event-subscribe.js +2 -1
  235. package/dist/mcp/handlers/coordination/event-subscribe.js.map +1 -1
  236. package/dist/mcp/handlers/coordination/workflow-checkpoint.d.ts.map +1 -1
  237. package/dist/mcp/handlers/coordination/workflow-checkpoint.js +2 -1
  238. package/dist/mcp/handlers/coordination/workflow-checkpoint.js.map +1 -1
  239. package/dist/mcp/handlers/coordination/workflow-create.d.ts.map +1 -1
  240. package/dist/mcp/handlers/coordination/workflow-create.js +2 -1
  241. package/dist/mcp/handlers/coordination/workflow-create.js.map +1 -1
  242. package/dist/mcp/handlers/coordination/workflow-execute.d.ts.map +1 -1
  243. package/dist/mcp/handlers/coordination/workflow-execute.js +2 -1
  244. package/dist/mcp/handlers/coordination/workflow-execute.js.map +1 -1
  245. package/dist/mcp/handlers/coordination/workflow-resume.d.ts.map +1 -1
  246. package/dist/mcp/handlers/coordination/workflow-resume.js +2 -1
  247. package/dist/mcp/handlers/coordination/workflow-resume.js.map +1 -1
  248. package/dist/mcp/handlers/fleet-init.d.ts.map +1 -1
  249. package/dist/mcp/handlers/fleet-init.js +2 -1
  250. package/dist/mcp/handlers/fleet-init.js.map +1 -1
  251. package/dist/mcp/handlers/fleet-status.d.ts.map +1 -1
  252. package/dist/mcp/handlers/fleet-status.js +31 -30
  253. package/dist/mcp/handlers/fleet-status.js.map +1 -1
  254. package/dist/mcp/handlers/integration/dependency-check.d.ts.map +1 -1
  255. package/dist/mcp/handlers/integration/dependency-check.js +3 -2
  256. package/dist/mcp/handlers/integration/dependency-check.js.map +1 -1
  257. package/dist/mcp/handlers/integration/integration-test-orchestrate.d.ts.map +1 -1
  258. package/dist/mcp/handlers/integration/integration-test-orchestrate.js +2 -1
  259. package/dist/mcp/handlers/integration/integration-test-orchestrate.js.map +1 -1
  260. package/dist/mcp/handlers/optimize-tests.d.ts.map +1 -1
  261. package/dist/mcp/handlers/optimize-tests.js +33 -32
  262. package/dist/mcp/handlers/optimize-tests.js.map +1 -1
  263. package/dist/mcp/handlers/predict-defects.d.ts.map +1 -1
  264. package/dist/mcp/handlers/predict-defects.js +46 -45
  265. package/dist/mcp/handlers/predict-defects.js.map +1 -1
  266. package/dist/mcp/handlers/prediction/deployment-readiness-check.d.ts.map +1 -1
  267. package/dist/mcp/handlers/prediction/deployment-readiness-check.js +24 -23
  268. package/dist/mcp/handlers/prediction/deployment-readiness-check.js.map +1 -1
  269. package/dist/mcp/handlers/prediction/predict-defects-ai.d.ts.map +1 -1
  270. package/dist/mcp/handlers/prediction/predict-defects-ai.js +10 -9
  271. package/dist/mcp/handlers/prediction/predict-defects-ai.js.map +1 -1
  272. package/dist/mcp/handlers/prediction/regression-risk-analyze.d.ts.map +1 -1
  273. package/dist/mcp/handlers/prediction/regression-risk-analyze.js +10 -9
  274. package/dist/mcp/handlers/prediction/regression-risk-analyze.js.map +1 -1
  275. package/dist/mcp/handlers/prediction/visual-test-regression.d.ts.map +1 -1
  276. package/dist/mcp/handlers/prediction/visual-test-regression.js +7 -6
  277. package/dist/mcp/handlers/prediction/visual-test-regression.js.map +1 -1
  278. package/dist/mcp/handlers/quality-analyze.d.ts.map +1 -1
  279. package/dist/mcp/handlers/quality-analyze.js +53 -52
  280. package/dist/mcp/handlers/quality-analyze.js.map +1 -1
  281. package/dist/mcp/handlers/task-orchestrate.d.ts.map +1 -1
  282. package/dist/mcp/handlers/task-orchestrate.js +19 -18
  283. package/dist/mcp/handlers/task-orchestrate.js.map +1 -1
  284. package/dist/mcp/handlers/test/test-execute-parallel.d.ts.map +1 -1
  285. package/dist/mcp/handlers/test/test-execute-parallel.js +7 -6
  286. package/dist/mcp/handlers/test/test-execute-parallel.js.map +1 -1
  287. package/dist/mcp/handlers/test/test-generate-enhanced.d.ts.map +1 -1
  288. package/dist/mcp/handlers/test/test-generate-enhanced.js +2 -1
  289. package/dist/mcp/handlers/test/test-generate-enhanced.js.map +1 -1
  290. package/dist/mcp/handlers/test/test-optimize-sublinear.d.ts.map +1 -1
  291. package/dist/mcp/handlers/test/test-optimize-sublinear.js +3 -2
  292. package/dist/mcp/handlers/test/test-optimize-sublinear.js.map +1 -1
  293. package/dist/mcp/handlers/test-execute.d.ts.map +1 -1
  294. package/dist/mcp/handlers/test-execute.js +11 -10
  295. package/dist/mcp/handlers/test-execute.js.map +1 -1
  296. package/dist/mcp/handlers/test-generate.d.ts.map +1 -1
  297. package/dist/mcp/handlers/test-generate.js +4 -3
  298. package/dist/mcp/handlers/test-generate.js.map +1 -1
  299. package/dist/mcp/services/AgentRegistry.d.ts.map +1 -1
  300. package/dist/mcp/services/AgentRegistry.js +2 -1
  301. package/dist/mcp/services/AgentRegistry.js.map +1 -1
  302. package/dist/mcp/streaming/CoverageAnalyzeStreamHandler.d.ts.map +1 -1
  303. package/dist/mcp/streaming/CoverageAnalyzeStreamHandler.js +10 -9
  304. package/dist/mcp/streaming/CoverageAnalyzeStreamHandler.js.map +1 -1
  305. package/dist/mcp/streaming/StreamingMCPTool.d.ts.map +1 -1
  306. package/dist/mcp/streaming/StreamingMCPTool.js +2 -1
  307. package/dist/mcp/streaming/StreamingMCPTool.js.map +1 -1
  308. package/dist/mcp/streaming/TestExecuteStreamHandler.d.ts.map +1 -1
  309. package/dist/mcp/streaming/TestExecuteStreamHandler.js +6 -5
  310. package/dist/mcp/streaming/TestExecuteStreamHandler.js.map +1 -1
  311. package/dist/reasoning/TestTemplateCreator.d.ts +10 -2
  312. package/dist/reasoning/TestTemplateCreator.d.ts.map +1 -1
  313. package/dist/reasoning/TestTemplateCreator.js +81 -21
  314. package/dist/reasoning/TestTemplateCreator.js.map +1 -1
  315. package/dist/types/pattern.types.d.ts +39 -3
  316. package/dist/types/pattern.types.d.ts.map +1 -1
  317. package/dist/utils/Config.js +2 -2
  318. package/dist/utils/Config.js.map +1 -1
  319. package/dist/utils/ProcessExit.d.ts +23 -0
  320. package/dist/utils/ProcessExit.d.ts.map +1 -0
  321. package/dist/utils/ProcessExit.js +40 -0
  322. package/dist/utils/ProcessExit.js.map +1 -0
  323. package/dist/utils/SecureRandom.d.ts +171 -0
  324. package/dist/utils/SecureRandom.d.ts.map +1 -0
  325. package/dist/utils/SecureRandom.js +229 -0
  326. package/dist/utils/SecureRandom.js.map +1 -0
  327. package/dist/utils/SecureUrlValidator.d.ts +167 -0
  328. package/dist/utils/SecureUrlValidator.d.ts.map +1 -0
  329. package/dist/utils/SecureUrlValidator.js +306 -0
  330. package/dist/utils/SecureUrlValidator.js.map +1 -0
  331. package/dist/utils/SecureValidation.d.ts +131 -0
  332. package/dist/utils/SecureValidation.d.ts.map +1 -0
  333. package/dist/utils/SecureValidation.js +265 -0
  334. package/dist/utils/SecureValidation.js.map +1 -0
  335. package/dist/utils/validation.d.ts.map +1 -1
  336. package/dist/utils/validation.js +5 -4
  337. package/dist/utils/validation.js.map +1 -1
  338. package/package.json +3 -3
@@ -0,0 +1,1067 @@
1
+ ---
2
+ name: test-data-management
3
+ description: Strategic test data generation, management, and privacy compliance. Use when creating test data, handling PII, ensuring GDPR/CCPA compliance, or scaling data generation for realistic testing scenarios.
4
+ version: 1.0.0
5
+ category: testing-infrastructure
6
+ tags:
7
+ - test-data
8
+ - data-generation
9
+ - data-privacy
10
+ - gdpr-compliance
11
+ - synthetic-data
12
+ - data-masking
13
+ - test-fixtures
14
+ difficulty: intermediate
15
+ estimated_time: 60-90 minutes
16
+ author: agentic-qe
17
+ ---
18
+
19
+ # Test Data Management
20
+
21
+ ## Core Principle
22
+
23
+ **Test data is the fuel for testing. Poor data = poor tests.**
24
+
25
+ 78% of QE teams cite test data as their #1 bottleneck. Good test data management enables fast, reliable, compliant testing at scale.
26
+
27
+ ## What is Test Data Management?
28
+
29
+ **Test Data Management:** Strategic creation, maintenance, and lifecycle management of data needed for testing, while ensuring privacy compliance and realistic scenarios.
30
+
31
+ **Why Critical:**
32
+ - 40% of test failures caused by inadequate test data
33
+ - GDPR/CCPA fines up to $20M or 4% of revenue
34
+ - Production data contains PII (illegal to use directly)
35
+ - AI/ML systems need massive, diverse datasets
36
+ - Manual data creation doesn't scale
37
+
38
+ **Goal:** Fast, realistic, compliant, scalable test data generation.
39
+
40
+ ## Test Data Strategies
41
+
42
+ ### Strategy 1: Minimal vs Realistic Data
43
+
44
+ **Minimal Data (Fast Tests)**
45
+ ```javascript
46
+ // Just enough to test logic
47
+ const user = {
48
+ id: 1,
49
+ email: 'test@example.com',
50
+ role: 'customer'
51
+ };
52
+
53
+ // Benefits:
54
+ // - Fast test execution
55
+ // - Easy to understand
56
+ // - Deterministic
57
+ // - No cleanup needed
58
+
59
+ // Use when:
60
+ // - Unit tests
61
+ // - Logic validation
62
+ // - Fast feedback needed
63
+ ```
64
+
65
+ **Realistic Data (Production-Like)**
66
+ ```javascript
67
+ // Production-like complexity
68
+ const user = {
69
+ id: '7f3a9c2e-4b1d-4e8a-9f2c-6d5e8a1b3c4d',
70
+ email: 'sarah.johnson@techcorp.com',
71
+ firstName: 'Sarah',
72
+ lastName: 'Johnson',
73
+ phone: '+1-555-0123',
74
+ address: {
75
+ street: '742 Evergreen Terrace',
76
+ city: 'Springfield',
77
+ state: 'IL',
78
+ zip: '62701',
79
+ country: 'US'
80
+ },
81
+ preferences: {
82
+ newsletter: true,
83
+ language: 'en-US',
84
+ timezone: 'America/Chicago'
85
+ },
86
+ createdAt: '2025-01-15T10:30:00Z',
87
+ lastLogin: '2025-10-24T14:22:15Z'
88
+ };
89
+
90
+ // Benefits:
91
+ // - Catches edge cases
92
+ // - Tests real-world scenarios
93
+ // - Validates integrations
94
+ // - Performance realistic
95
+
96
+ // Use when:
97
+ // - Integration tests
98
+ // - E2E tests
99
+ // - Performance tests
100
+ // - Production validation
101
+ ```
102
+
103
+ **Hybrid Approach (Best Practice)**
104
+ ```javascript
105
+ // Minimal for fast tests, realistic for critical paths
106
+ describe('User Service', () => {
107
+ // Unit test: minimal data
108
+ test('validates email format', () => {
109
+ expect(validateEmail('test@example.com')).toBe(true);
110
+ });
111
+
112
+ // Integration test: realistic data
113
+ test('creates user with full profile', async () => {
114
+ const user = generateRealisticUser(); // Full data
115
+ const result = await userService.create(user);
116
+ expect(result.profile.address.country).toBe('US');
117
+ });
118
+ });
119
+ ```
120
+
121
+ ---
122
+
123
+ ### Strategy 2: Shared vs Isolated Data
124
+
125
+ **Shared Data (Read-Only)**
126
+ ```javascript
127
+ // Seed database once, many tests use it
128
+ beforeAll(async () => {
129
+ await db.seed({
130
+ users: [
131
+ { id: 1, email: 'admin@example.com', role: 'admin' },
132
+ { id: 2, email: 'user@example.com', role: 'customer' }
133
+ ],
134
+ products: [
135
+ { id: 1, name: 'Widget', price: 9.99 },
136
+ { id: 2, name: 'Gadget', price: 19.99 }
137
+ ]
138
+ });
139
+ });
140
+
141
+ // Tests can read but not modify
142
+ test('admin can list all products', async () => {
143
+ const admin = await db.users.find({ id: 1 });
144
+ const products = await productService.list(admin);
145
+ expect(products.length).toBeGreaterThan(0);
146
+ });
147
+
148
+ // Benefits:
149
+ // - Fast (no setup per test)
150
+ // - Can run tests in parallel
151
+ // - Low resource usage
152
+
153
+ // Risks:
154
+ // - Tests must not modify data
155
+ // - Harder to debug (shared state)
156
+ ```
157
+
158
+ **Isolated Data (Per-Test)**
159
+ ```javascript
160
+ // Each test gets its own data
161
+ test('user can update profile', async () => {
162
+ // Generate unique data for this test
163
+ const user = await createTestUser({
164
+ email: `test-${Date.now()}@example.com`
165
+ });
166
+
167
+ await userService.updateProfile(user.id, { firstName: 'Updated' });
168
+
169
+ const updated = await db.users.find({ id: user.id });
170
+ expect(updated.firstName).toBe('Updated');
171
+
172
+ // Cleanup
173
+ await db.users.delete({ id: user.id });
174
+ });
175
+
176
+ // Benefits:
177
+ // - Tests independent
178
+ // - Can modify data freely
179
+ // - Easy to debug
180
+ // - No test pollution
181
+
182
+ // Costs:
183
+ // - Slower (setup per test)
184
+ // - More resource usage
185
+ // - Cleanup needed
186
+ ```
187
+
188
+ **Database Transactions (Best of Both)**
189
+ ```javascript
190
+ // Use transactions for isolation without cleanup
191
+ beforeEach(async () => {
192
+ await db.beginTransaction();
193
+ });
194
+
195
+ afterEach(async () => {
196
+ await db.rollbackTransaction(); // Auto cleanup!
197
+ });
198
+
199
+ test('user registration', async () => {
200
+ // Data exists only in this transaction
201
+ const user = await userService.register({
202
+ email: 'test@example.com'
203
+ });
204
+
205
+ expect(user.id).toBeDefined();
206
+ // Automatic rollback after test
207
+ });
208
+
209
+ // Benefits:
210
+ // - Isolated (transaction boundary)
211
+ // - Fast (no manual cleanup)
212
+ // - Reliable (guaranteed cleanup)
213
+ ```
214
+
215
+ ---
216
+
217
+ ### Strategy 3: Production Data vs Synthetic Data
218
+
219
+ **❌ Production Data (DANGER!)**
220
+ ```javascript
221
+ // NEVER do this:
222
+ const prodDb = connectTo('production://...');
223
+ const users = await prodDb.users.findAll(); // ⚠️ PII exposure!
224
+
225
+ // Problems:
226
+ // - Contains real PII (GDPR/CCPA violation)
227
+ // - Can modify production data accidentally
228
+ // - Performance impact on prod
229
+ // - Security risk
230
+ // - Legal liability
231
+ ```
232
+
233
+ **✅ Anonymized Production Data**
234
+ ```javascript
235
+ // Mask/anonymize production data
236
+ const anonymizedUsers = prodUsers.map(user => ({
237
+ id: user.id, // Keep ID for relationships
238
+ email: `user-${user.id}@example.com`, // Fake email
239
+ firstName: faker.name.firstName(), // Generated name
240
+ lastName: faker.name.lastName(),
241
+ phone: null, // Remove PII
242
+ address: {
243
+ city: user.address.city, // Keep non-PII
244
+ state: user.address.state,
245
+ zip: user.address.zip.substring(0, 3) + 'XX', // Partial zip
246
+ street: '***REDACTED***'
247
+ },
248
+ createdAt: user.createdAt // Keep timestamps
249
+ }));
250
+
251
+ // Benefits:
252
+ // - Realistic data patterns
253
+ // - Compliant with privacy laws
254
+ // - Safe for testing
255
+ ```
256
+
257
+ **✅ Synthetic Data (Best Practice)**
258
+ ```javascript
259
+ import { faker } from '@faker-js/faker';
260
+
261
+ // Generate realistic but fake data
262
+ function generateUser() {
263
+ return {
264
+ id: faker.string.uuid(),
265
+ email: faker.internet.email(),
266
+ firstName: faker.person.firstName(),
267
+ lastName: faker.person.lastName(),
268
+ phone: faker.phone.number(),
269
+ address: {
270
+ street: faker.location.streetAddress(),
271
+ city: faker.location.city(),
272
+ state: faker.location.state({ abbreviated: true }),
273
+ zip: faker.location.zipCode(),
274
+ country: 'US'
275
+ },
276
+ age: faker.number.int({ min: 18, max: 90 }),
277
+ createdAt: faker.date.past()
278
+ };
279
+ }
280
+
281
+ // Benefits:
282
+ // - No PII (privacy compliant)
283
+ // - Unlimited volume
284
+ // - Controlled characteristics
285
+ // - Repeatable with seeds
286
+ ```
287
+
288
+ ---
289
+
290
+ ## Data Generation Techniques
291
+
292
+ ### Technique 1: Faker Libraries
293
+
294
+ **Basic Usage**
295
+ ```javascript
296
+ import { faker } from '@faker-js/faker';
297
+
298
+ // Seed for reproducibility
299
+ faker.seed(123);
300
+
301
+ // Generate various data types
302
+ const testData = {
303
+ // Personal
304
+ name: faker.person.fullName(),
305
+ email: faker.internet.email(),
306
+ avatar: faker.image.avatar(),
307
+ bio: faker.person.bio(),
308
+
309
+ // Location
310
+ address: faker.location.streetAddress(),
311
+ city: faker.location.city(),
312
+ country: faker.location.country(),
313
+ coordinates: faker.location.nearbyGPSCoordinate(),
314
+
315
+ // Financial
316
+ accountNumber: faker.finance.accountNumber(),
317
+ amount: faker.finance.amount(),
318
+ currency: faker.finance.currencyCode(),
319
+ iban: faker.finance.iban(),
320
+
321
+ // Commerce
322
+ product: faker.commerce.productName(),
323
+ price: faker.commerce.price(),
324
+ department: faker.commerce.department(),
325
+
326
+ // Internet
327
+ username: faker.internet.userName(),
328
+ password: faker.internet.password(),
329
+ url: faker.internet.url(),
330
+ ipv4: faker.internet.ipv4(),
331
+
332
+ // Date/Time
333
+ pastDate: faker.date.past(),
334
+ futureDate: faker.date.future(),
335
+ recentDate: faker.date.recent(),
336
+
337
+ // Random
338
+ uuid: faker.string.uuid(),
339
+ alphanumeric: faker.string.alphanumeric(10),
340
+ hexadecimal: faker.string.hexadecimal(16)
341
+ };
342
+ ```
343
+
344
+ **Schema-Based Generation**
345
+ ```typescript
346
+ interface User {
347
+ id: string;
348
+ email: string;
349
+ profile: {
350
+ firstName: string;
351
+ lastName: string;
352
+ age: number;
353
+ };
354
+ roles: string[];
355
+ }
356
+
357
+ function generateUsers(count: number): User[] {
358
+ return Array.from({ length: count }, () => ({
359
+ id: faker.string.uuid(),
360
+ email: faker.internet.email(),
361
+ profile: {
362
+ firstName: faker.person.firstName(),
363
+ lastName: faker.person.lastName(),
364
+ age: faker.number.int({ min: 18, max: 90 })
365
+ },
366
+ roles: faker.helpers.arrayElements(['user', 'admin', 'moderator'])
367
+ }));
368
+ }
369
+
370
+ // Generate 1000 users
371
+ const users = generateUsers(1000);
372
+ ```
373
+
374
+ ---
375
+
376
+ ### Technique 2: Test Data Builders
377
+
378
+ **Builder Pattern**
379
+ ```typescript
380
+ class UserBuilder {
381
+ private user: Partial<User> = {};
382
+
383
+ withId(id: string) {
384
+ this.user.id = id;
385
+ return this;
386
+ }
387
+
388
+ withEmail(email: string) {
389
+ this.user.email = email;
390
+ return this;
391
+ }
392
+
393
+ withRole(role: string) {
394
+ this.user.role = role;
395
+ return this;
396
+ }
397
+
398
+ asAdmin() {
399
+ this.user.role = 'admin';
400
+ this.user.permissions = ['read', 'write', 'delete'];
401
+ return this;
402
+ }
403
+
404
+ asCustomer() {
405
+ this.user.role = 'customer';
406
+ this.user.permissions = ['read'];
407
+ return this;
408
+ }
409
+
410
+ build(): User {
411
+ // Fill in defaults for missing fields
412
+ return {
413
+ id: this.user.id ?? faker.string.uuid(),
414
+ email: this.user.email ?? faker.internet.email(),
415
+ role: this.user.role ?? 'customer',
416
+ permissions: this.user.permissions ?? ['read'],
417
+ createdAt: new Date()
418
+ } as User;
419
+ }
420
+ }
421
+
422
+ // Usage
423
+ const admin = new UserBuilder()
424
+ .asAdmin()
425
+ .withEmail('admin@example.com')
426
+ .build();
427
+
428
+ const customer = new UserBuilder()
429
+ .asCustomer()
430
+ .build();
431
+
432
+ // Flexible, readable, maintainable
433
+ ```
434
+
435
+ ---
436
+
437
+ ### Technique 3: Fixtures and Factories
438
+
439
+ **Fixture Files**
440
+ ```javascript
441
+ // fixtures/users.js
442
+ export const fixtures = {
443
+ adminUser: {
444
+ id: 1,
445
+ email: 'admin@example.com',
446
+ role: 'admin',
447
+ verified: true
448
+ },
449
+
450
+ regularUser: {
451
+ id: 2,
452
+ email: 'user@example.com',
453
+ role: 'customer',
454
+ verified: true
455
+ },
456
+
457
+ unverifiedUser: {
458
+ id: 3,
459
+ email: 'unverified@example.com',
460
+ role: 'customer',
461
+ verified: false
462
+ }
463
+ };
464
+
465
+ // Use in tests
466
+ import { fixtures } from './fixtures/users';
467
+
468
+ test('admin can delete users', async () => {
469
+ const admin = await createUser(fixtures.adminUser);
470
+ const user = await createUser(fixtures.regularUser);
471
+
472
+ await userService.delete(admin, user.id);
473
+ expect(await db.users.find(user.id)).toBeNull();
474
+ });
475
+ ```
476
+
477
+ **Factory Functions**
478
+ ```javascript
479
+ // factories/userFactory.js
480
+ export function createUser(overrides = {}) {
481
+ const defaults = {
482
+ id: faker.string.uuid(),
483
+ email: faker.internet.email(),
484
+ firstName: faker.person.firstName(),
485
+ lastName: faker.person.lastName(),
486
+ role: 'customer',
487
+ verified: true,
488
+ createdAt: new Date()
489
+ };
490
+
491
+ return { ...defaults, ...overrides };
492
+ }
493
+
494
+ export function createAdmin(overrides = {}) {
495
+ return createUser({
496
+ role: 'admin',
497
+ permissions: ['read', 'write', 'delete'],
498
+ ...overrides
499
+ });
500
+ }
501
+
502
+ // Use in tests
503
+ test('admin dashboard', async () => {
504
+ const admin = createAdmin({ email: 'specific@example.com' });
505
+ // Test with admin user
506
+ });
507
+ ```
508
+
509
+ ---
510
+
511
+ ## Data Privacy & Compliance
512
+
513
+ ### GDPR/CCPA Requirements
514
+
515
+ **What You Must Do:**
516
+ 1. **Minimize PII Collection**
517
+ - Only collect necessary data for testing
518
+ - Use synthetic data instead of production data
519
+ - Delete test data after use
520
+
521
+ 2. **Secure Storage**
522
+ - Encrypt sensitive test data
523
+ - Access controls on test databases
524
+ - Separate test from production
525
+
526
+ 3. **Data Anonymization**
527
+ - Mask/pseudonymize production data if used
528
+ - Remove direct identifiers
529
+ - K-anonymity for aggregate data
530
+
531
+ 4. **Right to Erasure**
532
+ - Easy deletion of test accounts
533
+ - Automated cleanup processes
534
+ - Audit trail of deletions
535
+
536
+ **Anonymization Techniques**
537
+ ```javascript
538
+ // Data masking
539
+ function maskEmail(email) {
540
+ const [user, domain] = email.split('@');
541
+ return `${user[0]}***@${domain}`;
542
+ }
543
+
544
+ function maskPhone(phone) {
545
+ return phone.replace(/\d(?=\d{4})/g, '*');
546
+ }
547
+
548
+ function maskCreditCard(cc) {
549
+ return `****-****-****-${cc.slice(-4)}`;
550
+ }
551
+
552
+ // Pseudonymization (reversible with key)
553
+ const crypto = require('crypto');
554
+
555
+ function pseudonymize(value, key) {
556
+ const cipher = crypto.createCipher('aes-256-cbc', key);
557
+ return cipher.update(value, 'utf8', 'hex') + cipher.final('hex');
558
+ }
559
+
560
+ function depseudonymize(encrypted, key) {
561
+ const decipher = crypto.createDecipher('aes-256-cbc', key);
562
+ return decipher.update(encrypted, 'hex', 'utf8') + decipher.final('utf8');
563
+ }
564
+
565
+ // Use in tests
566
+ const user = {
567
+ realEmail: 'john@example.com',
568
+ maskedEmail: maskEmail('john@example.com'), // 'j***@example.com'
569
+ pseudoEmail: pseudonymize('john@example.com', SECRET_KEY)
570
+ };
571
+ ```
572
+
573
+ **Data Retention Policies**
574
+ ```javascript
575
+ // Auto-delete old test data
576
+ async function cleanupOldTestData() {
577
+ const thirtyDaysAgo = new Date();
578
+ thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - 30);
579
+
580
+ // Delete test users older than 30 days
581
+ await db.users.deleteMany({
582
+ email: { $regex: /@example\.com$/ }, // Test emails
583
+ createdAt: { $lt: thirtyDaysAgo }
584
+ });
585
+
586
+ console.log('Cleaned up old test data');
587
+ }
588
+
589
+ // Run daily
590
+ schedule.scheduleJob('0 2 * * *', cleanupOldTestData);
591
+ ```
592
+
593
+ ---
594
+
595
+ ## Test Data Lifecycle
596
+
597
+ ### Phase 1: Setup/Seeding
598
+
599
+ **Database Seeding**
600
+ ```javascript
601
+ // seed.js
602
+ const seedData = {
603
+ users: [
604
+ { id: 1, email: 'admin@example.com', role: 'admin' },
605
+ { id: 2, email: 'user@example.com', role: 'customer' }
606
+ ],
607
+ products: [
608
+ { id: 1, name: 'Widget', price: 9.99, inStock: true },
609
+ { id: 2, name: 'Gadget', price: 19.99, inStock: true }
610
+ ]
611
+ };
612
+
613
+ async function seedDatabase() {
614
+ await db.users.insertMany(seedData.users);
615
+ await db.products.insertMany(seedData.products);
616
+ console.log('Database seeded');
617
+ }
618
+
619
+ // Run before tests
620
+ beforeAll(async () => {
621
+ await seedDatabase();
622
+ });
623
+ ```
624
+
625
+ ---
626
+
627
+ ### Phase 2: Test Execution
628
+
629
+ **Data Isolation During Tests**
630
+ ```javascript
631
+ describe('Order Service', () => {
632
+ let testUser;
633
+ let testProduct;
634
+
635
+ beforeEach(async () => {
636
+ // Create fresh data per test
637
+ testUser = await createTestUser();
638
+ testProduct = await createTestProduct();
639
+ });
640
+
641
+ afterEach(async () => {
642
+ // Cleanup after test
643
+ await deleteTestUser(testUser.id);
644
+ await deleteTestProduct(testProduct.id);
645
+ });
646
+
647
+ test('user can place order', async () => {
648
+ const order = await orderService.create({
649
+ userId: testUser.id,
650
+ productId: testProduct.id,
651
+ quantity: 1
652
+ });
653
+
654
+ expect(order.total).toBe(testProduct.price);
655
+ });
656
+ });
657
+ ```
658
+
659
+ ---
660
+
661
+ ### Phase 3: Cleanup/Reset
662
+
663
+ **Transaction-Based Cleanup**
664
+ ```javascript
665
+ // Best practice: use transactions
666
+ beforeEach(async () => {
667
+ await db.beginTransaction();
668
+ });
669
+
670
+ afterEach(async () => {
671
+ await db.rollbackTransaction(); // Auto cleanup
672
+ });
673
+ ```
674
+
675
+ **Manual Cleanup**
676
+ ```javascript
677
+ // Track created entities
678
+ const createdIds = {
679
+ users: [],
680
+ orders: [],
681
+ products: []
682
+ };
683
+
684
+ afterEach(async () => {
685
+ // Delete in reverse order (handle foreign keys)
686
+ await db.orders.deleteMany({ id: { $in: createdIds.orders } });
687
+ await db.products.deleteMany({ id: { $in: createdIds.products } });
688
+ await db.users.deleteMany({ id: { $in: createdIds.users } });
689
+
690
+ // Reset tracking
691
+ createdIds.users = [];
692
+ createdIds.orders = [];
693
+ createdIds.products = [];
694
+ });
695
+ ```
696
+
697
+ ---
698
+
699
+ ## Advanced Patterns
700
+
701
+ ### Pattern 1: Relational Data Generation
702
+
703
+ **Generate Related Entities**
704
+ ```javascript
705
+ async function generateOrderWithRelations() {
706
+ // Create user
707
+ const user = await db.users.create({
708
+ email: faker.internet.email(),
709
+ firstName: faker.person.firstName()
710
+ });
711
+
712
+ // Create products
713
+ const products = await Promise.all([
714
+ db.products.create({
715
+ name: faker.commerce.productName(),
716
+ price: faker.commerce.price()
717
+ }),
718
+ db.products.create({
719
+ name: faker.commerce.productName(),
720
+ price: faker.commerce.price()
721
+ })
722
+ ]);
723
+
724
+ // Create order with line items
725
+ const order = await db.orders.create({
726
+ userId: user.id,
727
+ status: 'pending',
728
+ lineItems: products.map(p => ({
729
+ productId: p.id,
730
+ quantity: faker.number.int({ min: 1, max: 5 }),
731
+ price: p.price
732
+ }))
733
+ });
734
+
735
+ return { user, products, order };
736
+ }
737
+
738
+ // Use in test
739
+ test('order total calculation', async () => {
740
+ const { order } = await generateOrderWithRelations();
741
+ expect(order.total).toBeGreaterThan(0);
742
+ });
743
+ ```
744
+
745
+ ---
746
+
747
+ ### Pattern 2: Edge Case Data
748
+
749
+ **Generate Boundary Values**
750
+ ```javascript
751
+ function generateEdgeCaseUsers() {
752
+ return [
753
+ // Minimum values
754
+ {
755
+ email: 'a@b.c', // Shortest valid email
756
+ age: 18, // Minimum age
757
+ name: 'A' // Single character
758
+ },
759
+
760
+ // Maximum values
761
+ {
762
+ email: 'a'.repeat(64) + '@' + 'b'.repeat(255), // Max length
763
+ age: 120,
764
+ name: 'A'.repeat(255)
765
+ },
766
+
767
+ // Special characters
768
+ {
769
+ email: "test+tag@example.com",
770
+ name: "O'Brien",
771
+ bio: "Test <script>alert('xss')</script>"
772
+ },
773
+
774
+ // Unicode
775
+ {
776
+ email: 'user@例え.jp',
777
+ name: '山田太郎',
778
+ city: '北京'
779
+ },
780
+
781
+ // Empty/null
782
+ {
783
+ email: 'empty@example.com',
784
+ middleName: null,
785
+ phone: ''
786
+ }
787
+ ];
788
+ }
789
+ ```
790
+
791
+ ---
792
+
793
+ ### Pattern 3: Volume Data Generation
794
+
795
+ **Generate Large Datasets**
796
+ ```javascript
797
+ // Generate 10,000 users efficiently
798
+ async function generateLargeUserDataset(count = 10000) {
799
+ const batchSize = 1000;
800
+ const batches = Math.ceil(count / batchSize);
801
+
802
+ for (let i = 0; i < batches; i++) {
803
+ const users = Array.from({ length: batchSize }, (_, index) => ({
804
+ id: i * batchSize + index,
805
+ email: `user${i * batchSize + index}@example.com`,
806
+ firstName: faker.person.firstName(),
807
+ lastName: faker.person.lastName(),
808
+ createdAt: faker.date.past()
809
+ }));
810
+
811
+ // Batch insert for performance
812
+ await db.users.insertMany(users);
813
+
814
+ console.log(`Inserted batch ${i + 1}/${batches}`);
815
+ }
816
+ }
817
+
818
+ // Performance test with realistic volume
819
+ test('search performs well with 10k users', async () => {
820
+ await generateLargeUserDataset(10000);
821
+
822
+ const start = Date.now();
823
+ const results = await userService.search('John');
824
+ const duration = Date.now() - start;
825
+
826
+ expect(duration).toBeLessThan(100); // < 100ms
827
+ });
828
+ ```
829
+
830
+ ---
831
+
832
+ ## Using with QE Agents
833
+
834
+ ### qe-test-data-architect: High-Speed Generation
835
+
836
+ **Generate 10k+ Records per Second**
837
+ ```typescript
838
+ // Agent generates realistic, schema-aware data
839
+ const testData = await agent.generateTestData({
840
+ schema: 'users',
841
+ count: 10000,
842
+ realistic: true,
843
+ constraints: {
844
+ age: { min: 18, max: 90 },
845
+ roles: ['customer', 'admin', 'moderator'],
846
+ emailDomain: 'example.com'
847
+ }
848
+ });
849
+
850
+ // Returns 10,000 fully populated user records
851
+ // With relationships, constraints, realistic patterns
852
+ ```
853
+
854
+ **Edge Case Discovery**
855
+ ```typescript
856
+ // Agent auto-discovers edge cases
857
+ const edgeCases = await agent.generateEdgeCases({
858
+ field: 'email',
859
+ patterns: [
860
+ 'special-chars',
861
+ 'unicode',
862
+ 'max-length',
863
+ 'min-length',
864
+ 'sql-injection',
865
+ 'xss-attempts'
866
+ ]
867
+ });
868
+
869
+ // Returns comprehensive edge case dataset
870
+ // 50+ edge cases for email field
871
+ ```
872
+
873
+ **GDPR-Compliant Data**
874
+ ```typescript
875
+ // Agent ensures privacy compliance
876
+ const anonymizedData = await agent.anonymizeProductionData({
877
+ source: productionSnapshot,
878
+ piiFields: ['email', 'phone', 'ssn', 'address'],
879
+ method: 'pseudonymization',
880
+ retainStructure: true
881
+ });
882
+
883
+ // Returns anonymized data maintaining referential integrity
884
+ ```
885
+
886
+ ---
887
+
888
+ ### Fleet Coordination for Complex Data Graphs
889
+
890
+ ```typescript
891
+ // Multiple agents coordinate for complex data
892
+ const dataFleet = await FleetManager.coordinate({
893
+ strategy: 'test-data-generation',
894
+ agents: [
895
+ 'qe-test-data-architect', // Generate base data
896
+ 'qe-test-generator', // Generate tests using data
897
+ 'qe-test-executor' // Execute with generated data
898
+ ],
899
+ topology: 'sequential'
900
+ });
901
+
902
+ await dataFleet.execute({
903
+ scenario: 'e-commerce-checkout',
904
+ volume: {
905
+ users: 1000,
906
+ products: 500,
907
+ orders: 5000
908
+ },
909
+ relationships: true,
910
+ realistic: true
911
+ });
912
+
913
+ // Generates full data graph:
914
+ // - 1000 users with profiles
915
+ // - 500 products with inventory
916
+ // - 5000 orders with line items
917
+ // - All relationships maintained
918
+ // - Tests generated and executed
919
+ ```
920
+
921
+ ---
922
+
923
+ ## Tools & Libraries
924
+
925
+ ### Data Generation
926
+ - **@faker-js/faker** - Comprehensive fake data generation
927
+ - **Mockaroo** - Online data generator (CSV, JSON, SQL)
928
+ - **Chance.js** - Random data generation
929
+ - **Casual** - Minimalist fake data
930
+ - **JSON Schema Faker** - Generate from JSON schemas
931
+
932
+ ### Database Tools
933
+ - **Factory Bot** (Ruby) - Test data factories
934
+ - **FactoryGuy** (JavaScript) - Ember.js factories
935
+ - **Fishery** (TypeScript) - Type-safe factories
936
+ - **Knex.js** - SQL query builder with seeding
937
+ - **Prisma** - ORM with seeding support
938
+
939
+ ### Privacy Tools
940
+ - **ARX Data Anonymization Tool** - GDPR compliance
941
+ - **sdv (Synthetic Data Vault)** - AI-generated synthetic data
942
+ - **Presidio** - PII detection and anonymization
943
+ - **Faker** - Built-in data masking
944
+
945
+ ---
946
+
947
+ ## Common Pitfalls
948
+
949
+ ### ❌ Using Production Data Directly
950
+ ```javascript
951
+ // NEVER do this
952
+ const prodUsers = await prodDb.query('SELECT * FROM users');
953
+ await testDb.insertMany(prodUsers); // ⚠️ PII violation
954
+ ```
955
+
956
+ **Fix:** Anonymize first or use synthetic data
957
+
958
+ ### ❌ Not Cleaning Up Test Data
959
+ ```javascript
960
+ // Creates 100 users per test, never deleted
961
+ test('many tests', async () => {
962
+ const users = await generateUsers(100);
963
+ // ... test code
964
+ // No cleanup! Database fills up
965
+ });
966
+ ```
967
+
968
+ **Fix:** Use transactions or cleanup hooks
969
+
970
+ ### ❌ Hard-Coded IDs
971
+ ```javascript
972
+ // Breaks when run in parallel or multiple times
973
+ const user = await createUser({ id: 1 }); // ⚠️ Collision risk
974
+ ```
975
+
976
+ **Fix:** Use generated UUIDs or auto-increment
977
+
978
+ ### ❌ Shared Mutable Data
979
+ ```javascript
980
+ // Tests pollute shared data
981
+ const sharedUser = createUser();
982
+
983
+ test('update email', () => {
984
+ sharedUser.email = 'new@example.com'; // Affects other tests!
985
+ });
986
+ ```
987
+
988
+ **Fix:** Create fresh data per test
989
+
990
+ ---
991
+
992
+ ## Best Practices Checklist
993
+
994
+ **Data Generation:**
995
+ - [ ] Use faker or similar library for realistic data
996
+ - [ ] Generate data with proper constraints
997
+ - [ ] Create both minimal and realistic datasets
998
+ - [ ] Include edge cases and boundary values
999
+ - [ ] Use builders/factories for complex entities
1000
+
1001
+ **Privacy & Compliance:**
1002
+ - [ ] Never use production PII directly
1003
+ - [ ] Anonymize/pseudonymize production data snapshots
1004
+ - [ ] Use synthetic data as default
1005
+ - [ ] Implement data retention policies
1006
+ - [ ] Document data handling procedures
1007
+
1008
+ **Performance:**
1009
+ - [ ] Batch insert for large datasets
1010
+ - [ ] Use database transactions for isolation
1011
+ - [ ] Generate data lazily when possible
1012
+ - [ ] Cache commonly used fixtures
1013
+ - [ ] Clean up data after tests
1014
+
1015
+ **Maintainability:**
1016
+ - [ ] Centralize test data generation
1017
+ - [ ] Version control seed data
1018
+ - [ ] Document data schemas
1019
+ - [ ] Use type-safe factories (TypeScript)
1020
+ - [ ] Keep data generation DRY
1021
+
1022
+ ---
1023
+
1024
+ ## Related Skills
1025
+
1026
+ **Testing Infrastructure:**
1027
+ - [test-automation-strategy](../test-automation-strategy/) - Automation includes data setup
1028
+ - [test-environment-management](../test-environment-management/) - Environments need data
1029
+ - [database-testing](../database-testing/) - Database schema and data integrity
1030
+
1031
+ **Testing Methodologies:**
1032
+ - [regression-testing](../regression-testing/) - Regression needs stable test data
1033
+ - [performance-testing](../performance-testing/) - Performance tests need volume data
1034
+ - [api-testing-patterns](../api-testing-patterns/) - API tests need request data
1035
+
1036
+ **Quality Management:**
1037
+ - [agentic-quality-engineering](../agentic-quality-engineering/) - Agent-driven data generation
1038
+ - [compliance-testing](../compliance-testing/) - GDPR/CCPA compliance validation
1039
+
1040
+ ---
1041
+
1042
+ ## Remember
1043
+
1044
+ **Test data is infrastructure, not an afterthought.**
1045
+
1046
+ Poor test data causes:
1047
+ - 40% of test failures
1048
+ - Hours wasted debugging
1049
+ - Unreliable test results
1050
+ - Privacy violations
1051
+ - Scaling bottlenecks
1052
+
1053
+ **Good test data management enables:**
1054
+ - Fast, reliable tests
1055
+ - Realistic scenarios
1056
+ - Privacy compliance
1057
+ - Scalable testing
1058
+ - Confident deployments
1059
+
1060
+ **Golden Rules:**
1061
+ 1. Never use production PII
1062
+ 2. Automate data generation
1063
+ 3. Clean up after tests
1064
+ 4. Use transactions for isolation
1065
+ 5. Generate edge cases systematically
1066
+
1067
+ **With Agents:** `qe-test-data-architect` generates 10k+ records/sec with realistic patterns, constraints, and relationships. Use agents to eliminate test data bottlenecks and ensure GDPR/CCPA compliance automatically.