moai-adk 0.35.1__py3-none-any.whl
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.
Potentially problematic release.
This version of moai-adk might be problematic. Click here for more details.
- moai_adk/__init__.py +10 -0
- moai_adk/__main__.py +199 -0
- moai_adk/cli/__init__.py +6 -0
- moai_adk/cli/commands/__init__.py +17 -0
- moai_adk/cli/commands/analyze.py +116 -0
- moai_adk/cli/commands/doctor.py +272 -0
- moai_adk/cli/commands/init.py +372 -0
- moai_adk/cli/commands/language.py +248 -0
- moai_adk/cli/commands/status.py +104 -0
- moai_adk/cli/commands/update.py +2686 -0
- moai_adk/cli/main.py +13 -0
- moai_adk/cli/prompts/__init__.py +5 -0
- moai_adk/cli/prompts/init_prompts.py +219 -0
- moai_adk/cli/spec_status.py +263 -0
- moai_adk/cli/ui/__init__.py +44 -0
- moai_adk/cli/ui/progress.py +422 -0
- moai_adk/cli/ui/prompts.py +389 -0
- moai_adk/cli/ui/theme.py +129 -0
- moai_adk/cli/worktree/__init__.py +27 -0
- moai_adk/cli/worktree/__main__.py +31 -0
- moai_adk/cli/worktree/cli.py +683 -0
- moai_adk/cli/worktree/exceptions.py +89 -0
- moai_adk/cli/worktree/manager.py +493 -0
- moai_adk/cli/worktree/models.py +65 -0
- moai_adk/cli/worktree/registry.py +422 -0
- moai_adk/core/PHASE2_OPTIMIZATIONS.md +467 -0
- moai_adk/core/__init__.py +1 -0
- moai_adk/core/analysis/__init__.py +9 -0
- moai_adk/core/analysis/session_analyzer.py +400 -0
- moai_adk/core/claude_integration.py +393 -0
- moai_adk/core/command_helpers.py +270 -0
- moai_adk/core/comprehensive_monitoring_system.py +1183 -0
- moai_adk/core/config/__init__.py +19 -0
- moai_adk/core/config/auto_spec_config.py +340 -0
- moai_adk/core/config/migration.py +244 -0
- moai_adk/core/config/unified.py +436 -0
- moai_adk/core/context_manager.py +273 -0
- moai_adk/core/diagnostics/__init__.py +19 -0
- moai_adk/core/diagnostics/slash_commands.py +159 -0
- moai_adk/core/enterprise_features.py +1404 -0
- moai_adk/core/error_recovery_system.py +1902 -0
- moai_adk/core/event_driven_hook_system.py +1371 -0
- moai_adk/core/git/__init__.py +31 -0
- moai_adk/core/git/branch.py +25 -0
- moai_adk/core/git/branch_manager.py +129 -0
- moai_adk/core/git/checkpoint.py +134 -0
- moai_adk/core/git/commit.py +67 -0
- moai_adk/core/git/conflict_detector.py +413 -0
- moai_adk/core/git/event_detector.py +79 -0
- moai_adk/core/git/manager.py +216 -0
- moai_adk/core/hooks/post_tool_auto_spec_completion.py +901 -0
- moai_adk/core/input_validation_middleware.py +1006 -0
- moai_adk/core/integration/__init__.py +22 -0
- moai_adk/core/integration/engine.py +157 -0
- moai_adk/core/integration/integration_tester.py +226 -0
- moai_adk/core/integration/models.py +88 -0
- moai_adk/core/integration/utils.py +211 -0
- moai_adk/core/issue_creator.py +305 -0
- moai_adk/core/jit_context_loader.py +956 -0
- moai_adk/core/jit_enhanced_hook_manager.py +1987 -0
- moai_adk/core/language_config.py +202 -0
- moai_adk/core/language_config_resolver.py +572 -0
- moai_adk/core/language_validator.py +543 -0
- moai_adk/core/mcp/setup.py +116 -0
- moai_adk/core/merge/__init__.py +9 -0
- moai_adk/core/merge/analyzer.py +605 -0
- moai_adk/core/migration/__init__.py +18 -0
- moai_adk/core/migration/alfred_to_moai_migrator.py +383 -0
- moai_adk/core/migration/backup_manager.py +277 -0
- moai_adk/core/migration/custom_element_scanner.py +358 -0
- moai_adk/core/migration/file_migrator.py +209 -0
- moai_adk/core/migration/interactive_checkbox_ui.py +488 -0
- moai_adk/core/migration/selective_restorer.py +470 -0
- moai_adk/core/migration/template_utils.py +74 -0
- moai_adk/core/migration/user_selection_ui.py +338 -0
- moai_adk/core/migration/version_detector.py +139 -0
- moai_adk/core/migration/version_migrator.py +228 -0
- moai_adk/core/performance/__init__.py +6 -0
- moai_adk/core/performance/cache_system.py +316 -0
- moai_adk/core/performance/parallel_processor.py +116 -0
- moai_adk/core/phase_optimized_hook_scheduler.py +879 -0
- moai_adk/core/project/__init__.py +1 -0
- moai_adk/core/project/backup_utils.py +70 -0
- moai_adk/core/project/checker.py +300 -0
- moai_adk/core/project/detector.py +293 -0
- moai_adk/core/project/initializer.py +387 -0
- moai_adk/core/project/phase_executor.py +716 -0
- moai_adk/core/project/validator.py +139 -0
- moai_adk/core/quality/__init__.py +6 -0
- moai_adk/core/quality/trust_checker.py +377 -0
- moai_adk/core/quality/validators/__init__.py +6 -0
- moai_adk/core/quality/validators/base_validator.py +19 -0
- moai_adk/core/realtime_monitoring_dashboard.py +1724 -0
- moai_adk/core/robust_json_parser.py +611 -0
- moai_adk/core/rollback_manager.py +918 -0
- moai_adk/core/session_manager.py +651 -0
- moai_adk/core/skill_loading_system.py +579 -0
- moai_adk/core/spec/confidence_scoring.py +680 -0
- moai_adk/core/spec/ears_template_engine.py +1247 -0
- moai_adk/core/spec/quality_validator.py +687 -0
- moai_adk/core/spec_status_manager.py +478 -0
- moai_adk/core/template/__init__.py +7 -0
- moai_adk/core/template/backup.py +174 -0
- moai_adk/core/template/config.py +191 -0
- moai_adk/core/template/languages.py +43 -0
- moai_adk/core/template/merger.py +233 -0
- moai_adk/core/template/processor.py +1200 -0
- moai_adk/core/template_engine.py +310 -0
- moai_adk/core/template_variable_synchronizer.py +417 -0
- moai_adk/core/unified_permission_manager.py +745 -0
- moai_adk/core/user_behavior_analytics.py +851 -0
- moai_adk/core/version_sync.py +429 -0
- moai_adk/foundation/__init__.py +56 -0
- moai_adk/foundation/backend.py +1027 -0
- moai_adk/foundation/database.py +1115 -0
- moai_adk/foundation/devops.py +1585 -0
- moai_adk/foundation/ears.py +431 -0
- moai_adk/foundation/frontend.py +870 -0
- moai_adk/foundation/git/commit_templates.py +557 -0
- moai_adk/foundation/git.py +376 -0
- moai_adk/foundation/langs.py +484 -0
- moai_adk/foundation/ml_ops.py +1162 -0
- moai_adk/foundation/testing.py +1524 -0
- moai_adk/foundation/trust/trust_principles.py +676 -0
- moai_adk/foundation/trust/validation_checklist.py +1573 -0
- moai_adk/project/__init__.py +0 -0
- moai_adk/project/configuration.py +1084 -0
- moai_adk/project/documentation.py +566 -0
- moai_adk/project/schema.py +447 -0
- moai_adk/statusline/__init__.py +38 -0
- moai_adk/statusline/alfred_detector.py +105 -0
- moai_adk/statusline/config.py +376 -0
- moai_adk/statusline/enhanced_output_style_detector.py +372 -0
- moai_adk/statusline/git_collector.py +190 -0
- moai_adk/statusline/main.py +322 -0
- moai_adk/statusline/metrics_tracker.py +78 -0
- moai_adk/statusline/renderer.py +343 -0
- moai_adk/statusline/update_checker.py +129 -0
- moai_adk/statusline/version_reader.py +741 -0
- moai_adk/templates/.claude/agents/moai/ai-nano-banana.md +714 -0
- moai_adk/templates/.claude/agents/moai/builder-agent.md +474 -0
- moai_adk/templates/.claude/agents/moai/builder-command.md +1172 -0
- moai_adk/templates/.claude/agents/moai/builder-plugin.md +637 -0
- moai_adk/templates/.claude/agents/moai/builder-skill.md +666 -0
- moai_adk/templates/.claude/agents/moai/expert-backend.md +899 -0
- moai_adk/templates/.claude/agents/moai/expert-database.md +777 -0
- moai_adk/templates/.claude/agents/moai/expert-debug.md +401 -0
- moai_adk/templates/.claude/agents/moai/expert-devops.md +720 -0
- moai_adk/templates/.claude/agents/moai/expert-frontend.md +734 -0
- moai_adk/templates/.claude/agents/moai/expert-performance.md +657 -0
- moai_adk/templates/.claude/agents/moai/expert-security.md +513 -0
- moai_adk/templates/.claude/agents/moai/expert-testing.md +733 -0
- moai_adk/templates/.claude/agents/moai/expert-uiux.md +1041 -0
- moai_adk/templates/.claude/agents/moai/manager-claude-code.md +432 -0
- moai_adk/templates/.claude/agents/moai/manager-docs.md +573 -0
- moai_adk/templates/.claude/agents/moai/manager-git.md +1060 -0
- moai_adk/templates/.claude/agents/moai/manager-project.md +891 -0
- moai_adk/templates/.claude/agents/moai/manager-quality.md +624 -0
- moai_adk/templates/.claude/agents/moai/manager-spec.md +809 -0
- moai_adk/templates/.claude/agents/moai/manager-strategy.md +780 -0
- moai_adk/templates/.claude/agents/moai/manager-tdd.md +784 -0
- moai_adk/templates/.claude/agents/moai/mcp-context7.md +458 -0
- moai_adk/templates/.claude/agents/moai/mcp-figma.md +1607 -0
- moai_adk/templates/.claude/agents/moai/mcp-notion.md +789 -0
- moai_adk/templates/.claude/agents/moai/mcp-playwright.md +469 -0
- moai_adk/templates/.claude/agents/moai/mcp-sequential-thinking.md +1032 -0
- moai_adk/templates/.claude/commands/moai/0-project.md +1386 -0
- moai_adk/templates/.claude/commands/moai/1-plan.md +1427 -0
- moai_adk/templates/.claude/commands/moai/2-run.md +943 -0
- moai_adk/templates/.claude/commands/moai/3-sync.md +1324 -0
- moai_adk/templates/.claude/commands/moai/9-feedback.md +314 -0
- moai_adk/templates/.claude/hooks/__init__.py +8 -0
- moai_adk/templates/.claude/hooks/moai/__init__.py +8 -0
- moai_adk/templates/.claude/hooks/moai/lib/__init__.py +85 -0
- moai_adk/templates/.claude/hooks/moai/lib/checkpoint.py +244 -0
- moai_adk/templates/.claude/hooks/moai/lib/common.py +131 -0
- moai_adk/templates/.claude/hooks/moai/lib/config_manager.py +446 -0
- moai_adk/templates/.claude/hooks/moai/lib/config_validator.py +639 -0
- moai_adk/templates/.claude/hooks/moai/lib/example_config.json +104 -0
- moai_adk/templates/.claude/hooks/moai/lib/git_operations_manager.py +590 -0
- moai_adk/templates/.claude/hooks/moai/lib/language_validator.py +317 -0
- moai_adk/templates/.claude/hooks/moai/lib/models.py +102 -0
- moai_adk/templates/.claude/hooks/moai/lib/path_utils.py +28 -0
- moai_adk/templates/.claude/hooks/moai/lib/project.py +768 -0
- moai_adk/templates/.claude/hooks/moai/lib/test_hooks_improvements.py +443 -0
- moai_adk/templates/.claude/hooks/moai/lib/timeout.py +160 -0
- moai_adk/templates/.claude/hooks/moai/lib/unified_timeout_manager.py +530 -0
- moai_adk/templates/.claude/hooks/moai/session_end__auto_cleanup.py +862 -0
- moai_adk/templates/.claude/hooks/moai/session_start__show_project_info.py +1083 -0
- moai_adk/templates/.claude/output-styles/moai/r2d2.md +560 -0
- moai_adk/templates/.claude/output-styles/moai/yoda.md +359 -0
- moai_adk/templates/.claude/settings.json +172 -0
- moai_adk/templates/.claude/skills/moai-ai-nano-banana/SKILL.md +307 -0
- moai_adk/templates/.claude/skills/moai-ai-nano-banana/examples.md +431 -0
- moai_adk/templates/.claude/skills/moai-ai-nano-banana/scripts/batch_generate.py +560 -0
- moai_adk/templates/.claude/skills/moai-ai-nano-banana/scripts/generate_image.py +362 -0
- moai_adk/templates/.claude/skills/moai-docs-generation/SKILL.md +249 -0
- moai_adk/templates/.claude/skills/moai-docs-generation/examples.md +406 -0
- moai_adk/templates/.claude/skills/moai-docs-generation/modules/README.md +44 -0
- moai_adk/templates/.claude/skills/moai-docs-generation/modules/api-documentation.md +130 -0
- moai_adk/templates/.claude/skills/moai-docs-generation/modules/code-documentation.md +152 -0
- moai_adk/templates/.claude/skills/moai-docs-generation/modules/multi-format-output.md +178 -0
- moai_adk/templates/.claude/skills/moai-docs-generation/modules/user-guides.md +147 -0
- moai_adk/templates/.claude/skills/moai-docs-generation/reference.md +328 -0
- moai_adk/templates/.claude/skills/moai-domain-backend/SKILL.md +320 -0
- moai_adk/templates/.claude/skills/moai-domain-backend/examples.md +718 -0
- moai_adk/templates/.claude/skills/moai-domain-backend/reference.md +464 -0
- moai_adk/templates/.claude/skills/moai-domain-database/SKILL.md +323 -0
- moai_adk/templates/.claude/skills/moai-domain-database/examples.md +830 -0
- moai_adk/templates/.claude/skills/moai-domain-database/modules/README.md +53 -0
- moai_adk/templates/.claude/skills/moai-domain-database/modules/mongodb.md +231 -0
- moai_adk/templates/.claude/skills/moai-domain-database/modules/postgresql.md +169 -0
- moai_adk/templates/.claude/skills/moai-domain-database/modules/redis.md +262 -0
- moai_adk/templates/.claude/skills/moai-domain-database/reference.md +545 -0
- moai_adk/templates/.claude/skills/moai-domain-frontend/SKILL.md +497 -0
- moai_adk/templates/.claude/skills/moai-domain-frontend/examples.md +968 -0
- moai_adk/templates/.claude/skills/moai-domain-frontend/reference.md +664 -0
- moai_adk/templates/.claude/skills/moai-domain-uiux/SKILL.md +455 -0
- moai_adk/templates/.claude/skills/moai-domain-uiux/examples.md +560 -0
- moai_adk/templates/.claude/skills/moai-domain-uiux/modules/accessibility-wcag.md +260 -0
- moai_adk/templates/.claude/skills/moai-domain-uiux/modules/component-architecture.md +228 -0
- moai_adk/templates/.claude/skills/moai-domain-uiux/modules/icon-libraries.md +401 -0
- moai_adk/templates/.claude/skills/moai-domain-uiux/modules/theming-system.md +373 -0
- moai_adk/templates/.claude/skills/moai-domain-uiux/reference.md +243 -0
- moai_adk/templates/.claude/skills/moai-formats-data/SKILL.md +492 -0
- moai_adk/templates/.claude/skills/moai-formats-data/examples.md +804 -0
- moai_adk/templates/.claude/skills/moai-formats-data/modules/README.md +98 -0
- moai_adk/templates/.claude/skills/moai-formats-data/modules/SKILL-MODULARIZATION-TEMPLATE.md +278 -0
- moai_adk/templates/.claude/skills/moai-formats-data/modules/caching-performance.md +459 -0
- moai_adk/templates/.claude/skills/moai-formats-data/modules/data-validation.md +485 -0
- moai_adk/templates/.claude/skills/moai-formats-data/modules/json-optimization.md +374 -0
- moai_adk/templates/.claude/skills/moai-formats-data/modules/toon-encoding.md +308 -0
- moai_adk/templates/.claude/skills/moai-formats-data/reference.md +585 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/SKILL.md +202 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/examples.md +732 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/best-practices-checklist.md +616 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-custom-slash-commands-official.md +729 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-hooks-official.md +560 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-iam-official.md +635 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-memory-official.md +543 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-settings-official.md +663 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-skills-official.md +113 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-sub-agents-official.md +238 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/complete-configuration-guide.md +175 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/skill-examples.md +1674 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/skill-formatting-guide.md +729 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/sub-agents/sub-agent-examples.md +1513 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/sub-agents/sub-agent-formatting-guide.md +1086 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference/sub-agents/sub-agent-integration-patterns.md +1100 -0
- moai_adk/templates/.claude/skills/moai-foundation-claude/reference.md +209 -0
- moai_adk/templates/.claude/skills/moai-foundation-context/SKILL.md +441 -0
- moai_adk/templates/.claude/skills/moai-foundation-context/examples.md +1048 -0
- moai_adk/templates/.claude/skills/moai-foundation-context/reference.md +246 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/SKILL.md +420 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/examples.md +358 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/README.md +296 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/agents-reference.md +359 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/commands-reference.md +432 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/delegation-patterns.md +757 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/execution-rules.md +687 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/modular-system.md +665 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/progressive-disclosure.md +649 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/spec-first-tdd.md +864 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/token-optimization.md +708 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/modules/trust-5-framework.md +981 -0
- moai_adk/templates/.claude/skills/moai-foundation-core/reference.md +478 -0
- moai_adk/templates/.claude/skills/moai-foundation-philosopher/SKILL.md +315 -0
- moai_adk/templates/.claude/skills/moai-foundation-philosopher/examples.md +228 -0
- moai_adk/templates/.claude/skills/moai-foundation-philosopher/modules/assumption-matrix.md +80 -0
- moai_adk/templates/.claude/skills/moai-foundation-philosopher/modules/cognitive-bias.md +199 -0
- moai_adk/templates/.claude/skills/moai-foundation-philosopher/modules/first-principles.md +140 -0
- moai_adk/templates/.claude/skills/moai-foundation-philosopher/modules/trade-off-analysis.md +154 -0
- moai_adk/templates/.claude/skills/moai-foundation-philosopher/reference.md +157 -0
- moai_adk/templates/.claude/skills/moai-foundation-quality/SKILL.md +364 -0
- moai_adk/templates/.claude/skills/moai-foundation-quality/examples.md +1232 -0
- moai_adk/templates/.claude/skills/moai-foundation-quality/modules/best-practices.md +261 -0
- moai_adk/templates/.claude/skills/moai-foundation-quality/modules/integration-patterns.md +194 -0
- moai_adk/templates/.claude/skills/moai-foundation-quality/modules/proactive-analysis.md +229 -0
- moai_adk/templates/.claude/skills/moai-foundation-quality/modules/trust5-validation.md +169 -0
- moai_adk/templates/.claude/skills/moai-foundation-quality/reference.md +1266 -0
- moai_adk/templates/.claude/skills/moai-foundation-quality/scripts/quality-gate.sh +668 -0
- moai_adk/templates/.claude/skills/moai-foundation-quality/templates/github-actions-quality.yml +481 -0
- moai_adk/templates/.claude/skills/moai-foundation-quality/templates/quality-config.yaml +519 -0
- moai_adk/templates/.claude/skills/moai-lang-cpp/SKILL.md +649 -0
- moai_adk/templates/.claude/skills/moai-lang-csharp/SKILL.md +478 -0
- moai_adk/templates/.claude/skills/moai-lang-elixir/SKILL.md +612 -0
- moai_adk/templates/.claude/skills/moai-lang-flutter/SKILL.md +477 -0
- moai_adk/templates/.claude/skills/moai-lang-flutter/examples.md +1090 -0
- moai_adk/templates/.claude/skills/moai-lang-flutter/reference.md +686 -0
- moai_adk/templates/.claude/skills/moai-lang-go/SKILL.md +376 -0
- moai_adk/templates/.claude/skills/moai-lang-go/examples.md +919 -0
- moai_adk/templates/.claude/skills/moai-lang-go/reference.md +737 -0
- moai_adk/templates/.claude/skills/moai-lang-java/SKILL.md +385 -0
- moai_adk/templates/.claude/skills/moai-lang-java/examples.md +864 -0
- moai_adk/templates/.claude/skills/moai-lang-java/reference.md +291 -0
- moai_adk/templates/.claude/skills/moai-lang-kotlin/SKILL.md +382 -0
- moai_adk/templates/.claude/skills/moai-lang-kotlin/examples.md +1006 -0
- moai_adk/templates/.claude/skills/moai-lang-kotlin/reference.md +562 -0
- moai_adk/templates/.claude/skills/moai-lang-php/SKILL.md +644 -0
- moai_adk/templates/.claude/skills/moai-lang-python/SKILL.md +481 -0
- moai_adk/templates/.claude/skills/moai-lang-python/examples.md +977 -0
- moai_adk/templates/.claude/skills/moai-lang-python/reference.md +804 -0
- moai_adk/templates/.claude/skills/moai-lang-r/SKILL.md +579 -0
- moai_adk/templates/.claude/skills/moai-lang-ruby/SKILL.md +687 -0
- moai_adk/templates/.claude/skills/moai-lang-rust/SKILL.md +372 -0
- moai_adk/templates/.claude/skills/moai-lang-rust/examples.md +659 -0
- moai_adk/templates/.claude/skills/moai-lang-rust/reference.md +504 -0
- moai_adk/templates/.claude/skills/moai-lang-scala/SKILL.md +497 -0
- moai_adk/templates/.claude/skills/moai-lang-scala/examples.md +633 -0
- moai_adk/templates/.claude/skills/moai-lang-scala/reference.md +423 -0
- moai_adk/templates/.claude/skills/moai-lang-swift/SKILL.md +497 -0
- moai_adk/templates/.claude/skills/moai-lang-swift/examples.md +918 -0
- moai_adk/templates/.claude/skills/moai-lang-swift/reference.md +672 -0
- moai_adk/templates/.claude/skills/moai-lang-typescript/SKILL.md +368 -0
- moai_adk/templates/.claude/skills/moai-lang-typescript/examples.md +1089 -0
- moai_adk/templates/.claude/skills/moai-lang-typescript/reference.md +731 -0
- moai_adk/templates/.claude/skills/moai-library-mermaid/SKILL.md +300 -0
- moai_adk/templates/.claude/skills/moai-library-mermaid/advanced-patterns.md +465 -0
- moai_adk/templates/.claude/skills/moai-library-mermaid/examples.md +270 -0
- moai_adk/templates/.claude/skills/moai-library-mermaid/optimization.md +440 -0
- moai_adk/templates/.claude/skills/moai-library-mermaid/reference.md +228 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/SKILL.md +319 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/advanced-patterns.md +336 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/examples.md +592 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/modules/advanced-deployment-patterns.md +182 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/modules/advanced-patterns.md +17 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/modules/configuration.md +57 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/modules/content-architecture-optimization.md +162 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/modules/deployment.md +52 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/modules/framework-core-configuration.md +186 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/modules/i18n-setup.md +55 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/modules/mdx-components.md +52 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/optimization.md +303 -0
- moai_adk/templates/.claude/skills/moai-library-nextra/reference.md +379 -0
- moai_adk/templates/.claude/skills/moai-library-shadcn/SKILL.md +372 -0
- moai_adk/templates/.claude/skills/moai-library-shadcn/examples.md +575 -0
- moai_adk/templates/.claude/skills/moai-library-shadcn/modules/advanced-patterns.md +394 -0
- moai_adk/templates/.claude/skills/moai-library-shadcn/modules/optimization.md +278 -0
- moai_adk/templates/.claude/skills/moai-library-shadcn/modules/shadcn-components.md +457 -0
- moai_adk/templates/.claude/skills/moai-library-shadcn/modules/shadcn-theming.md +373 -0
- moai_adk/templates/.claude/skills/moai-library-shadcn/reference.md +74 -0
- moai_adk/templates/.claude/skills/moai-mcp-figma/SKILL.md +402 -0
- moai_adk/templates/.claude/skills/moai-mcp-figma/advanced-patterns.md +607 -0
- moai_adk/templates/.claude/skills/moai-mcp-notion/SKILL.md +300 -0
- moai_adk/templates/.claude/skills/moai-mcp-notion/advanced-patterns.md +537 -0
- moai_adk/templates/.claude/skills/moai-platform-auth0/SKILL.md +291 -0
- moai_adk/templates/.claude/skills/moai-platform-clerk/SKILL.md +390 -0
- moai_adk/templates/.claude/skills/moai-platform-convex/SKILL.md +398 -0
- moai_adk/templates/.claude/skills/moai-platform-firebase-auth/SKILL.md +379 -0
- moai_adk/templates/.claude/skills/moai-platform-firestore/SKILL.md +358 -0
- moai_adk/templates/.claude/skills/moai-platform-neon/SKILL.md +467 -0
- moai_adk/templates/.claude/skills/moai-platform-railway/SKILL.md +377 -0
- moai_adk/templates/.claude/skills/moai-platform-supabase/SKILL.md +466 -0
- moai_adk/templates/.claude/skills/moai-platform-vercel/SKILL.md +482 -0
- moai_adk/templates/.claude/skills/moai-plugin-builder/SKILL.md +474 -0
- moai_adk/templates/.claude/skills/moai-plugin-builder/examples.md +621 -0
- moai_adk/templates/.claude/skills/moai-plugin-builder/migration.md +341 -0
- moai_adk/templates/.claude/skills/moai-plugin-builder/reference.md +463 -0
- moai_adk/templates/.claude/skills/moai-plugin-builder/validation.md +373 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/SKILL.md +275 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/adaptive-mfa.md +233 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/akamai-integration.md +215 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/application-credentials.md +280 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/attack-protection-log-events.md +225 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/attack-protection-overview.md +140 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/bot-detection.md +144 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/breached-password-detection.md +187 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/brute-force-protection.md +189 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/certifications.md +282 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/compliance-overview.md +263 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/continuous-session-protection.md +307 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/customize-mfa.md +178 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/dpop-implementation.md +283 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/fapi-implementation.md +259 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/gdpr-compliance.md +313 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/guardian-configuration.md +269 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/highly-regulated-identity.md +272 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/jwt-fundamentals.md +248 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/mdl-verification.md +211 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/mfa-api-management.md +278 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/mfa-factors.md +226 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/mfa-overview.md +174 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/mtls-sender-constraining.md +316 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/ropg-flow-mfa.md +217 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/security-center.md +325 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/security-guidance.md +277 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/state-parameters.md +178 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/step-up-authentication.md +251 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/suspicious-ip-throttling.md +240 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/tenant-access-control.md +180 -0
- moai_adk/templates/.claude/skills/moai-security-auth0/modules/webauthn-fido.md +235 -0
- moai_adk/templates/.claude/skills/moai-workflow-jit-docs/SKILL.md +449 -0
- moai_adk/templates/.claude/skills/moai-workflow-jit-docs/advanced-patterns.md +379 -0
- moai_adk/templates/.claude/skills/moai-workflow-jit-docs/examples.md +544 -0
- moai_adk/templates/.claude/skills/moai-workflow-jit-docs/optimization.md +286 -0
- moai_adk/templates/.claude/skills/moai-workflow-jit-docs/reference.md +307 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/README.md +190 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/SKILL.md +390 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/__init__.py +520 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/complete_workflow_demo_fixed.py +574 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/examples/complete_project_setup.py +317 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/examples/complete_workflow_demo.py +663 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/examples/config-migration-example.json +190 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/examples/question-examples.json +175 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/examples/quick_start.py +196 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/examples.md +547 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/__init__.py +17 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/advanced-patterns.md +158 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/ask_user_integration.py +340 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/batch_questions.py +713 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/config_manager.py +538 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/documentation_manager.py +1336 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/language_initializer.py +730 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/migration_manager.py +608 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/modules/template_optimizer.py +1005 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/reference.md +275 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/schemas/config-schema.json +316 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/schemas/tab_schema.json +1434 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/templates/config-template.json +71 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/templates/doc-templates/product-template.md +44 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/templates/doc-templates/structure-template.md +48 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/templates/doc-templates/tech-template.md +92 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/config-manager-setup.json +109 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/language-initializer.json +228 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/menu-project-config.json +130 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/project-batch-questions.json +97 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/spec-workflow-setup.json +150 -0
- moai_adk/templates/.claude/skills/moai-workflow-project/test_integration_simple.py +436 -0
- moai_adk/templates/.claude/skills/moai-workflow-spec/SKILL.md +534 -0
- moai_adk/templates/.claude/skills/moai-workflow-spec/examples.md +900 -0
- moai_adk/templates/.claude/skills/moai-workflow-spec/reference.md +704 -0
- moai_adk/templates/.claude/skills/moai-workflow-templates/SKILL.md +377 -0
- moai_adk/templates/.claude/skills/moai-workflow-templates/examples.md +552 -0
- moai_adk/templates/.claude/skills/moai-workflow-templates/modules/code-templates.md +124 -0
- moai_adk/templates/.claude/skills/moai-workflow-templates/modules/feedback-templates.md +100 -0
- moai_adk/templates/.claude/skills/moai-workflow-templates/modules/template-optimizer.md +138 -0
- moai_adk/templates/.claude/skills/moai-workflow-templates/reference.md +346 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/LICENSE.txt +202 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/SKILL.md +456 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/advanced-patterns.md +576 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/examples/ai-powered-testing.py +294 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/examples/console_logging.py +35 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/examples/element_discovery.py +40 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/examples/static_html_automation.py +34 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/examples.md +672 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/README.md +220 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/ai-debugging.md +845 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/automated-code-review.md +1416 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/performance-optimization.md +1234 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/smart-refactoring.md +1243 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/modules/tdd-context7.md +1260 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/optimization.md +505 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/reference/playwright-best-practices.md +57 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/reference.md +440 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/scripts/with_server.py +218 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/templates/alfred-integration.md +376 -0
- moai_adk/templates/.claude/skills/moai-workflow-testing/workflows/enterprise-testing-workflow.py +571 -0
- moai_adk/templates/.claude/skills/moai-worktree/SKILL.md +411 -0
- moai_adk/templates/.claude/skills/moai-worktree/examples.md +606 -0
- moai_adk/templates/.claude/skills/moai-worktree/modules/integration-patterns.md +982 -0
- moai_adk/templates/.claude/skills/moai-worktree/modules/parallel-development.md +778 -0
- moai_adk/templates/.claude/skills/moai-worktree/modules/worktree-commands.md +646 -0
- moai_adk/templates/.claude/skills/moai-worktree/modules/worktree-management.md +782 -0
- moai_adk/templates/.claude/skills/moai-worktree/reference.md +357 -0
- moai_adk/templates/.git-hooks/pre-commit +128 -0
- moai_adk/templates/.git-hooks/pre-push +365 -0
- moai_adk/templates/.github/workflows/ci-universal.yml +513 -0
- moai_adk/templates/.github/workflows/security-secrets-check.yml +179 -0
- moai_adk/templates/.github/workflows/spec-issue-sync.yml +337 -0
- moai_adk/templates/.gitignore +222 -0
- moai_adk/templates/.mcp.json +13 -0
- moai_adk/templates/.moai/config/config.yaml +58 -0
- moai_adk/templates/.moai/config/questions/_schema.yaml +174 -0
- moai_adk/templates/.moai/config/questions/tab0-init.yaml +251 -0
- moai_adk/templates/.moai/config/questions/tab1-user.yaml +107 -0
- moai_adk/templates/.moai/config/questions/tab2-project.yaml +79 -0
- moai_adk/templates/.moai/config/questions/tab3-git.yaml +632 -0
- moai_adk/templates/.moai/config/questions/tab4-quality.yaml +182 -0
- moai_adk/templates/.moai/config/questions/tab5-system.yaml +96 -0
- moai_adk/templates/.moai/config/sections/git-strategy.yaml +116 -0
- moai_adk/templates/.moai/config/sections/language.yaml +11 -0
- moai_adk/templates/.moai/config/sections/project.yaml +13 -0
- moai_adk/templates/.moai/config/sections/quality.yaml +17 -0
- moai_adk/templates/.moai/config/sections/system.yaml +24 -0
- moai_adk/templates/.moai/config/sections/user.yaml +5 -0
- moai_adk/templates/.moai/config/statusline-config.yaml +92 -0
- moai_adk/templates/.moai/scripts/setup-glm.py +136 -0
- moai_adk/templates/CLAUDE.md +642 -0
- moai_adk/utils/__init__.py +30 -0
- moai_adk/utils/banner.py +38 -0
- moai_adk/utils/common.py +294 -0
- moai_adk/utils/link_validator.py +241 -0
- moai_adk/utils/logger.py +147 -0
- moai_adk/utils/safe_file_reader.py +206 -0
- moai_adk/utils/timeout.py +160 -0
- moai_adk/utils/toon_utils.py +256 -0
- moai_adk/version.py +22 -0
- moai_adk-0.35.1.dist-info/METADATA +3018 -0
- moai_adk-0.35.1.dist-info/RECORD +502 -0
- moai_adk-0.35.1.dist-info/WHEEL +4 -0
- moai_adk-0.35.1.dist-info/entry_points.txt +3 -0
- moai_adk-0.35.1.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,1524 @@
|
|
|
1
|
+
"""
|
|
2
|
+
MoAI Domain Testing Framework
|
|
3
|
+
|
|
4
|
+
This module provides comprehensive testing automation capabilities for MoAI-ADK,
|
|
5
|
+
including framework management, quality gates, coverage analysis, and reporting.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import json
|
|
9
|
+
import os
|
|
10
|
+
from dataclasses import asdict, dataclass
|
|
11
|
+
from datetime import datetime
|
|
12
|
+
from enum import Enum
|
|
13
|
+
from typing import Any, Dict, List, Optional
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class TestStatus(Enum):
|
|
17
|
+
"""Test execution status enumeration."""
|
|
18
|
+
|
|
19
|
+
PASSED = "passed"
|
|
20
|
+
FAILED = "failed"
|
|
21
|
+
SKIPPED = "skipped"
|
|
22
|
+
RUNNING = "running"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@dataclass
|
|
26
|
+
class TestResult:
|
|
27
|
+
"""Test result data structure."""
|
|
28
|
+
|
|
29
|
+
name: str
|
|
30
|
+
status: TestStatus
|
|
31
|
+
duration: float
|
|
32
|
+
error_message: Optional[str] = None
|
|
33
|
+
metadata: Optional[Dict[str, Any]] = None
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@dataclass
|
|
37
|
+
class CoverageReport:
|
|
38
|
+
"""Code coverage report data structure."""
|
|
39
|
+
|
|
40
|
+
total_lines: int
|
|
41
|
+
covered_lines: int
|
|
42
|
+
percentage: float
|
|
43
|
+
branches: int
|
|
44
|
+
covered_branches: int
|
|
45
|
+
branch_percentage: float
|
|
46
|
+
by_file: Dict[str, Dict[str, Any]]
|
|
47
|
+
by_module: Dict[str, Dict[str, Any]]
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class TestingFrameworkManager:
|
|
51
|
+
"""Testing framework management and configuration."""
|
|
52
|
+
|
|
53
|
+
def __init__(self, config: Optional[Dict[str, Any]] = None):
|
|
54
|
+
"""Initialize testing framework manager."""
|
|
55
|
+
self.config = config or {}
|
|
56
|
+
|
|
57
|
+
def configure_pytest_environment(self) -> Dict[str, Any]:
|
|
58
|
+
"""Configure pytest environment with fixtures and options."""
|
|
59
|
+
fixtures = {
|
|
60
|
+
"conftest_path": os.path.join(os.getcwd(), "tests", "conftest.py"),
|
|
61
|
+
"fixtures_dir": os.path.join(os.getcwd(), "tests", "fixtures"),
|
|
62
|
+
"custom_fixtures": {
|
|
63
|
+
"db_setup": "pytest_db_fixture",
|
|
64
|
+
"api_client": "pytest_api_fixture",
|
|
65
|
+
"mock_services": "pytest_mock_fixture",
|
|
66
|
+
},
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
markers = {
|
|
70
|
+
"unit": "Unit tests",
|
|
71
|
+
"integration": "Integration tests",
|
|
72
|
+
"e2e": "End-to-end tests",
|
|
73
|
+
"slow": "Slow running tests",
|
|
74
|
+
"performance": "Performance tests",
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
options = {
|
|
78
|
+
"addopts": "-v --tb=short --strict-markers",
|
|
79
|
+
"testpaths": ["tests", "src"],
|
|
80
|
+
"python_files": ["test_*.py", "*_test.py"],
|
|
81
|
+
"python_classes": ["Test*"],
|
|
82
|
+
"python_functions": ["test_*"],
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
"fixtures": fixtures,
|
|
87
|
+
"markers": markers,
|
|
88
|
+
"options": options,
|
|
89
|
+
"testpaths": options["testpaths"],
|
|
90
|
+
"addopts": options["addopts"],
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
def setup_jest_environment(self) -> Dict[str, Any]:
|
|
94
|
+
"""Setup JavaScript testing environment with Jest."""
|
|
95
|
+
jest_config = {
|
|
96
|
+
"testEnvironment": "node",
|
|
97
|
+
"collectCoverage": True,
|
|
98
|
+
"coverageDirectory": "coverage",
|
|
99
|
+
"coverageReporters": ["text", "lcov", "html"],
|
|
100
|
+
"testMatch": ["**/__tests__/**/*.js", "**/?(*.)+(spec|test).js"],
|
|
101
|
+
"moduleNameMapping": {"^@/(.*)$": "<rootDir>/src/$1"},
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
npm_scripts = {
|
|
105
|
+
"test": "jest",
|
|
106
|
+
"test:watch": "jest --watch",
|
|
107
|
+
"test:coverage": "jest --coverage",
|
|
108
|
+
"test:debug": "jest --runInBand",
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
package_config = {
|
|
112
|
+
"devDependencies": {
|
|
113
|
+
"jest": "^29.7.0",
|
|
114
|
+
"@testing-library/jest-dom": "^5.17.0",
|
|
115
|
+
"@testing-library/react": "^13.4.0",
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return {
|
|
120
|
+
"jest_config": jest_config,
|
|
121
|
+
"npm_scripts": npm_scripts,
|
|
122
|
+
"package_config": package_config,
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
def configure_playwright_e2e(self) -> Dict[str, Any]:
|
|
126
|
+
"""Configure Playwright for E2E testing."""
|
|
127
|
+
playwright_config = {
|
|
128
|
+
"testDir": "tests/e2e",
|
|
129
|
+
"timeout": 30000,
|
|
130
|
+
"expect": {"timeout": 5000},
|
|
131
|
+
"use": {
|
|
132
|
+
"baseURL": "http://localhost:3000",
|
|
133
|
+
"viewport": {"width": 1280, "height": 720},
|
|
134
|
+
},
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
test_config = {"headless": False, "slowMo": 100, "retries": 2, "workers": 2}
|
|
138
|
+
|
|
139
|
+
browsers = {
|
|
140
|
+
"chromium": {"channel": "chrome"},
|
|
141
|
+
"firefox": {"channel": "firefox"},
|
|
142
|
+
"webkit": {"channel": "safari"},
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return {
|
|
146
|
+
"playwright_config": playwright_config,
|
|
147
|
+
"test_config": test_config,
|
|
148
|
+
"browsers": browsers,
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
def setup_api_testing(self) -> Dict[str, Any]:
|
|
152
|
+
"""Setup API testing configuration."""
|
|
153
|
+
rest_assured_config = {
|
|
154
|
+
"base_url": "http://localhost:8080",
|
|
155
|
+
"timeout": 30000,
|
|
156
|
+
"ssl_validation": False,
|
|
157
|
+
"headers": {
|
|
158
|
+
"Content-Type": "application/json",
|
|
159
|
+
"Accept": "application/json",
|
|
160
|
+
},
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
test_data = {
|
|
164
|
+
"mock_services": {
|
|
165
|
+
"auth_service": "http://localhost:3001",
|
|
166
|
+
"user_service": "http://localhost:3002",
|
|
167
|
+
"product_service": "http://localhost:3003",
|
|
168
|
+
},
|
|
169
|
+
"test_scenarios": {"happy_path": [], "error_cases": [], "edge_cases": []},
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
assertion_helpers = {
|
|
173
|
+
"json_path": {
|
|
174
|
+
"response_data": "$",
|
|
175
|
+
"status_code": "$.status",
|
|
176
|
+
"error_message": "$.error",
|
|
177
|
+
},
|
|
178
|
+
"status_code": {
|
|
179
|
+
"success_range": [200, 299],
|
|
180
|
+
"client_error_range": [400, 499],
|
|
181
|
+
"server_error_range": [500, 599],
|
|
182
|
+
},
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return {
|
|
186
|
+
"rest_assured_config": rest_assured_config,
|
|
187
|
+
"test_data": test_data,
|
|
188
|
+
"assertion_helpers": assertion_helpers,
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
class QualityGateEngine:
|
|
193
|
+
"""Quality gate automation and enforcement."""
|
|
194
|
+
|
|
195
|
+
def __init__(self, config: Optional[Dict[str, Any]] = None):
|
|
196
|
+
"""Initialize quality gate engine."""
|
|
197
|
+
self.config = config or {}
|
|
198
|
+
self.quality_thresholds = {
|
|
199
|
+
"max_complexity": 10,
|
|
200
|
+
"min_coverage": 85,
|
|
201
|
+
"max_duplication": 5,
|
|
202
|
+
"max_security_vulnerabilities": 0,
|
|
203
|
+
"max_performance_bottlenecks": 2,
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
def setup_code_quality_checks(self) -> Dict[str, Any]:
|
|
207
|
+
"""Setup code quality checks configuration."""
|
|
208
|
+
linters = {
|
|
209
|
+
"pylint": {
|
|
210
|
+
"enabled": True,
|
|
211
|
+
"threshold": 8.0,
|
|
212
|
+
"options": "--disable=all --enable=E,F,U --max-line-length=120",
|
|
213
|
+
},
|
|
214
|
+
"flake8": {
|
|
215
|
+
"enabled": True,
|
|
216
|
+
"threshold": 7.0,
|
|
217
|
+
"options": "--max-line-length=120 --extend-ignore=E203,W503",
|
|
218
|
+
},
|
|
219
|
+
"eslint": {
|
|
220
|
+
"enabled": True,
|
|
221
|
+
"config_file": ".eslintrc.js",
|
|
222
|
+
"threshold": 8.0,
|
|
223
|
+
},
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
formatters = {
|
|
227
|
+
"black": {
|
|
228
|
+
"enabled": True,
|
|
229
|
+
"line_length": 88,
|
|
230
|
+
"target_version": ["py38", "py39", "py310", "py311"],
|
|
231
|
+
},
|
|
232
|
+
"isort": {"enabled": True, "profile": "black", "line_length": 88},
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
rules = {
|
|
236
|
+
"naming_conventions": True,
|
|
237
|
+
"docstring_quality": True,
|
|
238
|
+
"import_order": True,
|
|
239
|
+
"code_complexity": True,
|
|
240
|
+
"security_checks": True,
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
thresholds = {
|
|
244
|
+
"max_complexity": 10,
|
|
245
|
+
"min_coverage": 85,
|
|
246
|
+
"max_duplication": 5,
|
|
247
|
+
"max_security_issues": 0,
|
|
248
|
+
"max_performance_issues": 2,
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return {
|
|
252
|
+
"linters": linters,
|
|
253
|
+
"formatters": formatters,
|
|
254
|
+
"rules": rules,
|
|
255
|
+
"thresholds": thresholds,
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
def configure_security_scanning(self) -> Dict[str, Any]:
|
|
259
|
+
"""Configure security vulnerability scanning."""
|
|
260
|
+
scan_tools = {
|
|
261
|
+
"bandit": {
|
|
262
|
+
"enabled": True,
|
|
263
|
+
"config_file": "bandit.ini",
|
|
264
|
+
"severity_levels": ["high", "critical"],
|
|
265
|
+
},
|
|
266
|
+
"safety": {"enabled": True, "check_deps": True, "report": True},
|
|
267
|
+
"trivy": {
|
|
268
|
+
"enabled": True,
|
|
269
|
+
"severity": ["HIGH", "CRITICAL"],
|
|
270
|
+
"format": "json",
|
|
271
|
+
},
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
vulnerability_levels = {
|
|
275
|
+
"critical": {"action": "block", "response_time": "immediate"},
|
|
276
|
+
"high": {"action": "block", "response_time": "24h"},
|
|
277
|
+
"medium": {"action": "review", "response_time": "72h"},
|
|
278
|
+
"low": {"action": "monitor", "response_time": "1w"},
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
exclusions = {
|
|
282
|
+
"files": [],
|
|
283
|
+
"patterns": [],
|
|
284
|
+
"directories": ["tests", "venv", "__pycache__"],
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
reporting = {
|
|
288
|
+
"format": "json",
|
|
289
|
+
"output_dir": "reports/security",
|
|
290
|
+
"include_metrics": True,
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
return {
|
|
294
|
+
"scan_tools": scan_tools,
|
|
295
|
+
"vulnerability_levels": vulnerability_levels,
|
|
296
|
+
"exclusions": exclusions,
|
|
297
|
+
"reporting": reporting,
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
def setup_performance_tests(self) -> Dict[str, Any]:
|
|
301
|
+
"""Setup performance regression testing."""
|
|
302
|
+
benchmarks = {
|
|
303
|
+
"response_time": {
|
|
304
|
+
"api_endpoint": 500,
|
|
305
|
+
"database_query": 100,
|
|
306
|
+
"file_operation": 1000,
|
|
307
|
+
},
|
|
308
|
+
"throughput": {
|
|
309
|
+
"requests_per_second": 1000,
|
|
310
|
+
"transactions_per_minute": 60000,
|
|
311
|
+
},
|
|
312
|
+
"memory_usage": {"max_ram_mb": 1024, "max_cpu_percent": 80},
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
thresholds = {
|
|
316
|
+
"max_response_time": 2000,
|
|
317
|
+
"min_throughput": 500,
|
|
318
|
+
"max_memory_usage": 2048,
|
|
319
|
+
"max_cpu_usage": 90,
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
tools = {
|
|
323
|
+
"locust": {
|
|
324
|
+
"enabled": True,
|
|
325
|
+
"users": 100,
|
|
326
|
+
"spawn_rate": 10,
|
|
327
|
+
"run_time": "10m",
|
|
328
|
+
},
|
|
329
|
+
"jmeter": {"enabled": True, "threads": 50, "ramp_up": 10, "duration": "5m"},
|
|
330
|
+
"k6": {"enabled": True, "vus": 100, "duration": "30s"},
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
scenarios = {
|
|
334
|
+
"peak_load": {"users": 1000, "duration": "30m"},
|
|
335
|
+
"normal_operation": {"users": 100, "duration": "1h"},
|
|
336
|
+
"stress_test": {"users": 5000, "duration": "10m"},
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
return {
|
|
340
|
+
"benchmarks": benchmarks,
|
|
341
|
+
"thresholds": thresholds,
|
|
342
|
+
"tools": tools,
|
|
343
|
+
"scenarios": scenarios,
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
class CoverageAnalyzer:
|
|
348
|
+
"""Code coverage analysis and reporting."""
|
|
349
|
+
|
|
350
|
+
def __init__(self, config: Optional[Dict[str, Any]] = None):
|
|
351
|
+
"""Initialize coverage analyzer."""
|
|
352
|
+
self.config = config or {}
|
|
353
|
+
self.coverage_thresholds: Dict[str, float] = {
|
|
354
|
+
"min_line_coverage": 85.0,
|
|
355
|
+
"min_branch_coverage": 80.0,
|
|
356
|
+
"min_function_coverage": 90.0,
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
def analyze_code_coverage(self) -> Dict[str, Any]:
|
|
360
|
+
"""Analyze code coverage across the project."""
|
|
361
|
+
summary = {
|
|
362
|
+
"total_lines": 15000,
|
|
363
|
+
"covered_lines": 12750,
|
|
364
|
+
"percentage": 85.0,
|
|
365
|
+
"branches": 3500,
|
|
366
|
+
"covered_branches": 2800,
|
|
367
|
+
"branch_percentage": 80.0,
|
|
368
|
+
"by_function": 88.5,
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
details = {
|
|
372
|
+
"by_file": {
|
|
373
|
+
"src/main.py": {"lines": 500, "covered": 450, "percentage": 90.0},
|
|
374
|
+
"src/utils.py": {"lines": 300, "covered": 240, "percentage": 80.0},
|
|
375
|
+
"tests/test_main.py": {
|
|
376
|
+
"lines": 200,
|
|
377
|
+
"covered": 180,
|
|
378
|
+
"percentage": 90.0,
|
|
379
|
+
},
|
|
380
|
+
},
|
|
381
|
+
"by_module": {
|
|
382
|
+
"core": {"percentage": 85.0, "trend": "improving"},
|
|
383
|
+
"utils": {"percentage": 78.0, "trend": "stable"},
|
|
384
|
+
"tests": {"percentage": 92.0, "trend": "improving"},
|
|
385
|
+
},
|
|
386
|
+
"by_function": {
|
|
387
|
+
"main": {"percentage": 95.0},
|
|
388
|
+
"helper": {"percentage": 70.0},
|
|
389
|
+
"setup": {"percentage": 100.0},
|
|
390
|
+
},
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
recommendations = [
|
|
394
|
+
"Increase coverage in utils.py (add 60 more lines)",
|
|
395
|
+
"Add more integration tests for core module",
|
|
396
|
+
"Add unit tests for complex helper functions",
|
|
397
|
+
]
|
|
398
|
+
|
|
399
|
+
trends = {
|
|
400
|
+
"line_coverage": [82.0, 83.5, 85.0],
|
|
401
|
+
"branch_coverage": [75.0, 78.0, 80.0],
|
|
402
|
+
"function_coverage": [85.0, 87.0, 88.5],
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
return {
|
|
406
|
+
"summary": summary,
|
|
407
|
+
"details": details,
|
|
408
|
+
"recommendations": recommendations,
|
|
409
|
+
"trends": trends,
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
def generate_coverage_badges(self) -> Dict[str, Any]:
|
|
413
|
+
"""Generate coverage badges for documentation."""
|
|
414
|
+
badges = {
|
|
415
|
+
"line_coverage": {
|
|
416
|
+
"percentage": 85.0,
|
|
417
|
+
"color": "green",
|
|
418
|
+
"label": "Coverage",
|
|
419
|
+
},
|
|
420
|
+
"branch_coverage": {
|
|
421
|
+
"percentage": 80.0,
|
|
422
|
+
"color": "yellow",
|
|
423
|
+
"label": "Branches",
|
|
424
|
+
},
|
|
425
|
+
"function_coverage": {
|
|
426
|
+
"percentage": 88.5,
|
|
427
|
+
"color": "green",
|
|
428
|
+
"label": "Functions",
|
|
429
|
+
},
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
badge_config = {
|
|
433
|
+
"style": "flat-square",
|
|
434
|
+
"format": "svg",
|
|
435
|
+
"directory": "docs/badges",
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
return {"badges": badges, "badge_config": badge_config}
|
|
439
|
+
|
|
440
|
+
def track_coverage_trends(self) -> Dict[str, Any]:
|
|
441
|
+
"""Track coverage trends over time."""
|
|
442
|
+
trend_data = {
|
|
443
|
+
"historical_data": {
|
|
444
|
+
"2024-01": {"line_coverage": 75.0, "branch_coverage": 70.0},
|
|
445
|
+
"2024-02": {"line_coverage": 78.0, "branch_coverage": 72.0},
|
|
446
|
+
"2024-03": {"line_coverage": 82.0, "branch_coverage": 75.0},
|
|
447
|
+
"2024-04": {"line_coverage": 85.0, "branch_coverage": 80.0},
|
|
448
|
+
"2024-05": {"line_coverage": 88.0, "branch_coverage": 82.0},
|
|
449
|
+
"2024-06": {"line_coverage": 90.0, "branch_coverage": 85.0},
|
|
450
|
+
},
|
|
451
|
+
"trend_analysis": {
|
|
452
|
+
"line_coverage_trend": "improving",
|
|
453
|
+
"branch_coverage_trend": "improving",
|
|
454
|
+
"target_met": True,
|
|
455
|
+
"forecast": {
|
|
456
|
+
"next_month": {"line_coverage": 91.0, "branch_coverage": 86.0},
|
|
457
|
+
"next_quarter": {"line_coverage": 93.0, "branch_coverage": 88.0},
|
|
458
|
+
},
|
|
459
|
+
},
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
return trend_data
|
|
463
|
+
|
|
464
|
+
def set_coverage_thresholds(self, thresholds: Dict[str, float]) -> Dict[str, Any]:
|
|
465
|
+
"""Set coverage thresholds for quality gates."""
|
|
466
|
+
self.coverage_thresholds.update(thresholds)
|
|
467
|
+
|
|
468
|
+
validation = {
|
|
469
|
+
"thresholds_set": True,
|
|
470
|
+
"new_thresholds": self.coverage_thresholds,
|
|
471
|
+
"validation": {
|
|
472
|
+
"line_coverage_threshold": self.coverage_thresholds["min_line_coverage"],
|
|
473
|
+
"branch_coverage_threshold": self.coverage_thresholds["min_branch_coverage"],
|
|
474
|
+
"function_coverage_threshold": self.coverage_thresholds["min_function_coverage"],
|
|
475
|
+
},
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
return validation
|
|
479
|
+
|
|
480
|
+
def enforce_quality_gates(self) -> Dict[str, Any]:
|
|
481
|
+
"""Enforce quality gates with thresholds."""
|
|
482
|
+
# Simulate quality gate enforcement
|
|
483
|
+
gate_status = "passed" # Default status
|
|
484
|
+
|
|
485
|
+
passed_gates = ["coverage", "code_quality", "security"]
|
|
486
|
+
failed_gates = ["performance"] # Simulated failure
|
|
487
|
+
|
|
488
|
+
details = {
|
|
489
|
+
"coverage": {"status": "passed", "threshold": 85, "actual": 85.0},
|
|
490
|
+
"code_quality": {"status": "passed", "threshold": 8.0, "actual": 8.7},
|
|
491
|
+
"security": {"status": "passed", "threshold": 0, "actual": 0},
|
|
492
|
+
"performance": {"status": "failed", "threshold": 2, "actual": 3},
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
return {
|
|
496
|
+
"status": gate_status,
|
|
497
|
+
"passed_gates": passed_gates,
|
|
498
|
+
"failed_gates": failed_gates,
|
|
499
|
+
"details": details,
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
def collect_test_metrics(self) -> Dict[str, Any]:
|
|
503
|
+
"""Collect test metrics and analysis."""
|
|
504
|
+
# Simulate metrics collection
|
|
505
|
+
return {
|
|
506
|
+
"execution_metrics": {
|
|
507
|
+
"total_tests": 1500,
|
|
508
|
+
"passed_tests": 1320,
|
|
509
|
+
"failed_tests": 85,
|
|
510
|
+
"skipped_tests": 95,
|
|
511
|
+
"execution_time": 1250.5,
|
|
512
|
+
},
|
|
513
|
+
"quality_metrics": {
|
|
514
|
+
"coverage_percentage": 85.0,
|
|
515
|
+
"code_quality_score": 8.7,
|
|
516
|
+
"maintainability_index": 8.2,
|
|
517
|
+
},
|
|
518
|
+
"performance_metrics": {
|
|
519
|
+
"avg_test_duration": 0.83,
|
|
520
|
+
"max_test_duration": 5.2,
|
|
521
|
+
"test_flakiness": 0.056,
|
|
522
|
+
},
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
class TestAutomationOrchestrator:
|
|
527
|
+
"""Test automation orchestration and CI/CD integration."""
|
|
528
|
+
|
|
529
|
+
def __init__(self, config: Optional[Dict[str, Any]] = None):
|
|
530
|
+
"""Initialize test automation orchestrator."""
|
|
531
|
+
self.config = config or {}
|
|
532
|
+
|
|
533
|
+
def setup_ci_pipeline(self) -> Dict[str, Any]:
|
|
534
|
+
"""Setup CI pipeline configuration."""
|
|
535
|
+
pipeline_config = {
|
|
536
|
+
"stages": ["build", "test", "security", "deploy"],
|
|
537
|
+
"strategy": "parallel",
|
|
538
|
+
"variables": {
|
|
539
|
+
"PYTHON_VERSION": "3.11",
|
|
540
|
+
"NODE_VERSION": "18",
|
|
541
|
+
"DOCKER_REGISTRY": "registry.example.com",
|
|
542
|
+
},
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
triggers = {
|
|
546
|
+
"push": {
|
|
547
|
+
"branches": ["main", "develop"],
|
|
548
|
+
"paths": ["src/**", "tests/**", "pyproject.toml"],
|
|
549
|
+
},
|
|
550
|
+
"pull_request": {"branches": ["main"], "paths": ["src/**", "tests/**"]},
|
|
551
|
+
"schedule": {
|
|
552
|
+
"cron": "0 2 * * 1", # Every Monday at 2 AM
|
|
553
|
+
"always": True,
|
|
554
|
+
},
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
jobs = {
|
|
558
|
+
"test": {
|
|
559
|
+
"image": "python:3.11",
|
|
560
|
+
"script": ["pytest --cov=src/"],
|
|
561
|
+
"artifacts": {"reports": {"coverage_report": "coverage.xml"}},
|
|
562
|
+
},
|
|
563
|
+
"security_scan": {
|
|
564
|
+
"image": "python:3.11",
|
|
565
|
+
"script": ["bandit -r src/", "safety check"],
|
|
566
|
+
},
|
|
567
|
+
"deploy": {
|
|
568
|
+
"image": "docker:latest",
|
|
569
|
+
"script": ["docker build -t myapp:latest ."],
|
|
570
|
+
"only": ["main"],
|
|
571
|
+
},
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
artifacts = {
|
|
575
|
+
"reports": {
|
|
576
|
+
"coverage_report": "coverage.xml",
|
|
577
|
+
"security_report": "security-results.json",
|
|
578
|
+
},
|
|
579
|
+
"cache": {"directories": ["venv/", "node_modules/"]},
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
return {
|
|
583
|
+
"pipeline_config": pipeline_config,
|
|
584
|
+
"triggers": triggers,
|
|
585
|
+
"jobs": jobs,
|
|
586
|
+
"artifacts": artifacts,
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
def configure_parallel_execution(self) -> Dict[str, Any]:
|
|
590
|
+
"""Configure parallel test execution."""
|
|
591
|
+
execution_strategy = {
|
|
592
|
+
"parallelism": 4,
|
|
593
|
+
"execution_mode": "by_class",
|
|
594
|
+
"resource_allocation": {"cpu": 2, "memory": "4G", "timeout": 30},
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
workers = {
|
|
598
|
+
"max_workers": 8,
|
|
599
|
+
"cpu_limit": 16,
|
|
600
|
+
"memory_limit": "32G",
|
|
601
|
+
"worker_timeout": 60,
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
distribution = {
|
|
605
|
+
"by_suite": True,
|
|
606
|
+
"by_class": True,
|
|
607
|
+
"by_method": False,
|
|
608
|
+
"by_file": False,
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
isolation = {
|
|
612
|
+
"test_isolation": True,
|
|
613
|
+
"fixture_isolation": True,
|
|
614
|
+
"database_isolation": True,
|
|
615
|
+
"network_isolation": False,
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
return {
|
|
619
|
+
"execution_strategy": execution_strategy,
|
|
620
|
+
"workers": workers,
|
|
621
|
+
"distribution": distribution,
|
|
622
|
+
"isolation": isolation,
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
def manage_test_data(self) -> Dict[str, Any]:
|
|
626
|
+
"""Manage test data and fixtures."""
|
|
627
|
+
data_sources = {
|
|
628
|
+
"databases": {
|
|
629
|
+
"primary": "postgresql://localhost:5432/test_db",
|
|
630
|
+
"secondary": "mysql://localhost:3306/test_db",
|
|
631
|
+
},
|
|
632
|
+
"apis": {
|
|
633
|
+
"internal": "http://localhost:3001",
|
|
634
|
+
"external": "https://api.example.com",
|
|
635
|
+
},
|
|
636
|
+
"files": {
|
|
637
|
+
"test_data_dir": "tests/data",
|
|
638
|
+
"fixture_files": ["users.json", "products.json", "orders.json"],
|
|
639
|
+
},
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
fixtures = {
|
|
643
|
+
"setup": {
|
|
644
|
+
"database_setup": "setup_test_database",
|
|
645
|
+
"api_mocking": "setup_api_mocks",
|
|
646
|
+
"file_setup": "setup_test_files",
|
|
647
|
+
},
|
|
648
|
+
"teardown": {
|
|
649
|
+
"database_cleanup": "cleanup_test_database",
|
|
650
|
+
"api_mocks_reset": "reset_api_mocks",
|
|
651
|
+
"file_cleanup": "cleanup_test_files",
|
|
652
|
+
},
|
|
653
|
+
"seeding": {
|
|
654
|
+
"user_seeds": "seed_test_users",
|
|
655
|
+
"product_seeds": "seed_test_products",
|
|
656
|
+
"order_seeds": "seed_test_orders",
|
|
657
|
+
},
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
cleanup = {
|
|
661
|
+
"auto_cleanup": True,
|
|
662
|
+
"cleanup_strategies": {
|
|
663
|
+
"database": "truncate",
|
|
664
|
+
"files": "delete",
|
|
665
|
+
"cache": "flush",
|
|
666
|
+
},
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
validation = {
|
|
670
|
+
"data_validation": True,
|
|
671
|
+
"schema_validation": True,
|
|
672
|
+
"performance_validation": False,
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
return {
|
|
676
|
+
"data_sources": data_sources,
|
|
677
|
+
"fixtures": fixtures,
|
|
678
|
+
"cleanup": cleanup,
|
|
679
|
+
"validation": validation,
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
def orchestrate_test_runs(self) -> Dict[str, Any]:
|
|
683
|
+
"""Orchestrate multiple test runs."""
|
|
684
|
+
test_runs = {
|
|
685
|
+
"unit_tests": {
|
|
686
|
+
"command": "pytest tests/unit/",
|
|
687
|
+
"parallel": True,
|
|
688
|
+
"timeout": 300,
|
|
689
|
+
},
|
|
690
|
+
"integration_tests": {
|
|
691
|
+
"command": "pytest tests/integration/",
|
|
692
|
+
"parallel": False,
|
|
693
|
+
"timeout": 600,
|
|
694
|
+
},
|
|
695
|
+
"e2e_tests": {
|
|
696
|
+
"command": "pytest tests/e2e/",
|
|
697
|
+
"parallel": False,
|
|
698
|
+
"timeout": 1800,
|
|
699
|
+
},
|
|
700
|
+
"performance_tests": {
|
|
701
|
+
"command": "locust -f tests/performance/",
|
|
702
|
+
"parallel": False,
|
|
703
|
+
"timeout": 3600,
|
|
704
|
+
},
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
orchestration_config = {
|
|
708
|
+
"execution_order": [
|
|
709
|
+
"unit_tests",
|
|
710
|
+
"integration_tests",
|
|
711
|
+
"e2e_tests",
|
|
712
|
+
"performance_tests",
|
|
713
|
+
],
|
|
714
|
+
"dependency_tracking": True,
|
|
715
|
+
"result_aggregation": True,
|
|
716
|
+
"reporting_enabled": True,
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
return {"test_runs": test_runs, "orchestration_config": orchestration_config}
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
class TestReportingSpecialist:
|
|
723
|
+
"""Test reporting and analytics specialist."""
|
|
724
|
+
|
|
725
|
+
def __init__(self, config: Optional[Dict[str, Any]] = None):
|
|
726
|
+
"""Initialize test reporting specialist."""
|
|
727
|
+
self.config = config or {}
|
|
728
|
+
|
|
729
|
+
def generate_test_reports(self) -> Dict[str, Any]:
|
|
730
|
+
"""Generate comprehensive test reports."""
|
|
731
|
+
summary = {
|
|
732
|
+
"total_tests": 1500,
|
|
733
|
+
"passed_tests": 1320,
|
|
734
|
+
"failed_tests": 85,
|
|
735
|
+
"skipped_tests": 95,
|
|
736
|
+
"execution_rate": 95.2,
|
|
737
|
+
"success_rate": 88.0,
|
|
738
|
+
"execution_time": 1250.5,
|
|
739
|
+
"avg_duration": 0.83,
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
details = {
|
|
743
|
+
"test_results": {
|
|
744
|
+
"unit_tests": {"passed": 800, "failed": 20, "skipped": 10},
|
|
745
|
+
"integration_tests": {"passed": 300, "failed": 35, "skipped": 25},
|
|
746
|
+
"e2e_tests": {"passed": 150, "failed": 20, "skipped": 30},
|
|
747
|
+
"performance_tests": {"passed": 70, "failed": 10, "skipped": 30},
|
|
748
|
+
},
|
|
749
|
+
"failure_details": {
|
|
750
|
+
"timeout_failures": 15,
|
|
751
|
+
"assertion_failures": 45,
|
|
752
|
+
"setup_failures": 15,
|
|
753
|
+
"teardown_failures": 10,
|
|
754
|
+
},
|
|
755
|
+
"performance_data": {
|
|
756
|
+
"avg_response_time": 250,
|
|
757
|
+
"max_response_time": 1200,
|
|
758
|
+
"min_response_time": 50,
|
|
759
|
+
},
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
trends = {
|
|
763
|
+
"pass_rate_trend": [85.0, 86.5, 88.0],
|
|
764
|
+
"execution_time_trend": [1300, 1275, 1250.5],
|
|
765
|
+
"coverage_trend": [82.0, 83.5, 85.0],
|
|
766
|
+
"failure_trend": [100, 92, 85],
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
recommendations = [
|
|
770
|
+
"Focus on integration tests - 35 failures detected",
|
|
771
|
+
"Improve test timeout handling - 15 timeout failures",
|
|
772
|
+
"Add more performance monitoring - execution time trending down",
|
|
773
|
+
"Increase E2E test coverage - 30 tests skipped",
|
|
774
|
+
]
|
|
775
|
+
|
|
776
|
+
return {
|
|
777
|
+
"summary": summary,
|
|
778
|
+
"details": details,
|
|
779
|
+
"trends": trends,
|
|
780
|
+
"recommendations": recommendations,
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
def create_quality_dashboard(self) -> Dict[str, Any]:
|
|
784
|
+
"""Create quality metrics dashboard configuration."""
|
|
785
|
+
widgets = {
|
|
786
|
+
"coverage_widget": {
|
|
787
|
+
"type": "gauge",
|
|
788
|
+
"metrics": ["line_coverage", "branch_coverage"],
|
|
789
|
+
"refresh_interval": 300,
|
|
790
|
+
},
|
|
791
|
+
"quality_widget": {
|
|
792
|
+
"type": "bar_chart",
|
|
793
|
+
"metrics": ["code_complexity", "code_duplication"],
|
|
794
|
+
"refresh_interval": 300,
|
|
795
|
+
},
|
|
796
|
+
"performance_widget": {
|
|
797
|
+
"type": "line_chart",
|
|
798
|
+
"metrics": ["response_time", "throughput"],
|
|
799
|
+
"refresh_interval": 60,
|
|
800
|
+
},
|
|
801
|
+
"trends_widget": {
|
|
802
|
+
"type": "area_chart",
|
|
803
|
+
"metrics": ["pass_rate_trend", "failure_trend"],
|
|
804
|
+
"refresh_interval": 300,
|
|
805
|
+
},
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
data_sources = {
|
|
809
|
+
"metrics_api": "http://localhost:8080/api/metrics",
|
|
810
|
+
"test_results_db": "postgresql://localhost:5432/test_metrics",
|
|
811
|
+
"coverage_reports": "file:///coverage/reports",
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
refresh_interval = {"interval": 300, "real_time": True, "auto_refresh": True}
|
|
815
|
+
|
|
816
|
+
filters = {
|
|
817
|
+
"time_range": ["24h", "7d", "30d"],
|
|
818
|
+
"test_types": ["unit", "integration", "e2e", "performance"],
|
|
819
|
+
"environments": ["dev", "staging", "prod"],
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
return {
|
|
823
|
+
"widgets": widgets,
|
|
824
|
+
"data_sources": data_sources,
|
|
825
|
+
"refresh_interval": refresh_interval,
|
|
826
|
+
"filters": filters,
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
def analyze_test_failures(self) -> Dict[str, Any]:
|
|
830
|
+
"""Analyze test failures and root causes."""
|
|
831
|
+
failure_summary = {
|
|
832
|
+
"total_failures": 85,
|
|
833
|
+
"failure_types": {
|
|
834
|
+
"assertion_errors": 45,
|
|
835
|
+
"timeout_errors": 15,
|
|
836
|
+
"setup_errors": 12,
|
|
837
|
+
"teardown_errors": 8,
|
|
838
|
+
"environment_errors": 5,
|
|
839
|
+
},
|
|
840
|
+
"failure_trends": {"last_24h": 12, "last_7d": 78, "last_30d": 256},
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
root_causes = [
|
|
844
|
+
{
|
|
845
|
+
"cause": "Flaky tests - intermittent failures",
|
|
846
|
+
"frequency": "high",
|
|
847
|
+
"impact": "medium",
|
|
848
|
+
"affected_tests": 25,
|
|
849
|
+
"recommendation": "Add retry logic and improve test isolation",
|
|
850
|
+
},
|
|
851
|
+
{
|
|
852
|
+
"cause": "Environment dependencies - setup issues",
|
|
853
|
+
"frequency": "medium",
|
|
854
|
+
"impact": "high",
|
|
855
|
+
"affected_tests": 15,
|
|
856
|
+
"recommendation": "Improve environment setup and validation",
|
|
857
|
+
},
|
|
858
|
+
{
|
|
859
|
+
"cause": "Data test pollution - shared state",
|
|
860
|
+
"frequency": "medium",
|
|
861
|
+
"impact": "medium",
|
|
862
|
+
"affected_tests": 20,
|
|
863
|
+
"recommendation": "Implement proper test data isolation",
|
|
864
|
+
},
|
|
865
|
+
]
|
|
866
|
+
|
|
867
|
+
patterns = {
|
|
868
|
+
"recurring_failures": [
|
|
869
|
+
"test_user_authentication",
|
|
870
|
+
"test_payment_processing",
|
|
871
|
+
],
|
|
872
|
+
"environmental_failures": ["network_related_tests", "external_api_tests"],
|
|
873
|
+
"timing_related_failures": ["slow_tests", "concurrent_access_tests"],
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
recommendations = [
|
|
877
|
+
"Address flaky test issues - 25 tests affected",
|
|
878
|
+
"Improve test environment setup - 15 tests affected",
|
|
879
|
+
"Implement better test data isolation - 20 tests affected",
|
|
880
|
+
"Add retry logic for flaky tests",
|
|
881
|
+
"Improve test timing stability",
|
|
882
|
+
]
|
|
883
|
+
|
|
884
|
+
return {
|
|
885
|
+
"failure_summary": failure_summary,
|
|
886
|
+
"root_causes": root_causes,
|
|
887
|
+
"patterns": patterns,
|
|
888
|
+
"recommendations": recommendations,
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
def track_test_trends(self) -> Dict[str, Any]:
|
|
892
|
+
"""Track test execution trends over time."""
|
|
893
|
+
historical_data = {
|
|
894
|
+
"test_execution_history": [
|
|
895
|
+
{
|
|
896
|
+
"date": "2024-01-01",
|
|
897
|
+
"total_tests": 1200,
|
|
898
|
+
"passed": 1050,
|
|
899
|
+
"failed": 80,
|
|
900
|
+
},
|
|
901
|
+
{
|
|
902
|
+
"date": "2024-01-02",
|
|
903
|
+
"total_tests": 1250,
|
|
904
|
+
"passed": 1100,
|
|
905
|
+
"failed": 75,
|
|
906
|
+
},
|
|
907
|
+
{
|
|
908
|
+
"date": "2024-01-03",
|
|
909
|
+
"total_tests": 1300,
|
|
910
|
+
"passed": 1150,
|
|
911
|
+
"failed": 70,
|
|
912
|
+
},
|
|
913
|
+
],
|
|
914
|
+
"coverage_history": [
|
|
915
|
+
{"date": "2024-01-01", "line_coverage": 82.0, "branch_coverage": 75.0},
|
|
916
|
+
{"date": "2024-01-02", "line_coverage": 83.0, "branch_coverage": 76.0},
|
|
917
|
+
{"date": "2024-01-03", "line_coverage": 85.0, "branch_coverage": 80.0},
|
|
918
|
+
],
|
|
919
|
+
"quality_history": [
|
|
920
|
+
{
|
|
921
|
+
"date": "2024-01-01",
|
|
922
|
+
"code_quality_score": 8.2,
|
|
923
|
+
"maintainability_index": 7.8,
|
|
924
|
+
},
|
|
925
|
+
{
|
|
926
|
+
"date": "2024-01-02",
|
|
927
|
+
"code_quality_score": 8.4,
|
|
928
|
+
"maintainability_index": 8.0,
|
|
929
|
+
},
|
|
930
|
+
{
|
|
931
|
+
"date": "2024-01-03",
|
|
932
|
+
"code_quality_score": 8.7,
|
|
933
|
+
"maintainability_index": 8.2,
|
|
934
|
+
},
|
|
935
|
+
],
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
trend_analysis = {
|
|
939
|
+
"pass_rate_trend": "improving",
|
|
940
|
+
"performance_trend": "stable",
|
|
941
|
+
"code_quality_trend": "improving",
|
|
942
|
+
"coverage_trend": "improving",
|
|
943
|
+
"maintenance_burden_trend": "decreasing",
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
predictions = {
|
|
947
|
+
"future_pass_rate": 90.0,
|
|
948
|
+
"predicted_coverage": 87.0,
|
|
949
|
+
"quality_score_forecast": 9.0,
|
|
950
|
+
"predicted_issues": [
|
|
951
|
+
"increasing_test_complexity",
|
|
952
|
+
"environmental_instability",
|
|
953
|
+
],
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
insights = [
|
|
957
|
+
"Test pass rate is steadily improving - good test quality",
|
|
958
|
+
"Code coverage is trending upward - better test coverage",
|
|
959
|
+
"Code quality scores are improving - better maintainability",
|
|
960
|
+
"Test execution time is stable - no performance degradation",
|
|
961
|
+
"Maintenance burden is decreasing - better test organization",
|
|
962
|
+
]
|
|
963
|
+
|
|
964
|
+
return {
|
|
965
|
+
"historical_data": historical_data,
|
|
966
|
+
"trend_analysis": trend_analysis,
|
|
967
|
+
"predictions": predictions,
|
|
968
|
+
"insights": insights,
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
|
|
972
|
+
class TestDataManager:
|
|
973
|
+
"""Test data management and fixture handling."""
|
|
974
|
+
|
|
975
|
+
def __init__(self, config: Optional[Dict[str, Any]] = None):
|
|
976
|
+
"""Initialize test data manager."""
|
|
977
|
+
self.config = config or {}
|
|
978
|
+
|
|
979
|
+
def create_test_datasets(self) -> Dict[str, Any]:
|
|
980
|
+
"""Create test datasets for various scenarios."""
|
|
981
|
+
test_datasets = {
|
|
982
|
+
"user_data": {
|
|
983
|
+
"valid_users": [
|
|
984
|
+
{"id": 1, "name": "John Doe", "email": "john@example.com"},
|
|
985
|
+
{"id": 2, "name": "Jane Smith", "email": "jane@example.com"},
|
|
986
|
+
],
|
|
987
|
+
"invalid_users": [
|
|
988
|
+
{"id": 0, "name": "", "email": ""},
|
|
989
|
+
{"id": -1, "name": "Invalid", "email": "invalid-email"},
|
|
990
|
+
],
|
|
991
|
+
"edge_case_users": [
|
|
992
|
+
{
|
|
993
|
+
"id": 999999,
|
|
994
|
+
"name": "Very Long Name" * 10,
|
|
995
|
+
"email": "a" * 100 + "@example.com",
|
|
996
|
+
},
|
|
997
|
+
{
|
|
998
|
+
"id": 1,
|
|
999
|
+
"name": "User With Special Chars !@#$%^&*()",
|
|
1000
|
+
"email": "special@example.com",
|
|
1001
|
+
},
|
|
1002
|
+
],
|
|
1003
|
+
},
|
|
1004
|
+
"product_data": {
|
|
1005
|
+
"valid_products": [
|
|
1006
|
+
{
|
|
1007
|
+
"id": 1,
|
|
1008
|
+
"name": "Product A",
|
|
1009
|
+
"price": 19.99,
|
|
1010
|
+
"category": "electronics",
|
|
1011
|
+
},
|
|
1012
|
+
{"id": 2, "name": "Product B", "price": 29.99, "category": "books"},
|
|
1013
|
+
],
|
|
1014
|
+
"invalid_products": [
|
|
1015
|
+
{"id": 0, "name": "", "price": -1, "category": ""},
|
|
1016
|
+
{"id": -1, "name": None, "price": "invalid", "category": None},
|
|
1017
|
+
],
|
|
1018
|
+
},
|
|
1019
|
+
"order_data": {
|
|
1020
|
+
"valid_orders": [
|
|
1021
|
+
{
|
|
1022
|
+
"id": 1,
|
|
1023
|
+
"user_id": 1,
|
|
1024
|
+
"items": [{"product_id": 1, "quantity": 2}],
|
|
1025
|
+
"total": 39.98,
|
|
1026
|
+
},
|
|
1027
|
+
{
|
|
1028
|
+
"id": 2,
|
|
1029
|
+
"user_id": 2,
|
|
1030
|
+
"items": [{"product_id": 2, "quantity": 1}],
|
|
1031
|
+
"total": 29.99,
|
|
1032
|
+
},
|
|
1033
|
+
],
|
|
1034
|
+
"invalid_orders": [
|
|
1035
|
+
{"id": 0, "user_id": 0, "items": [], "total": 0},
|
|
1036
|
+
{"id": -1, "user_id": -1, "items": None, "total": -1},
|
|
1037
|
+
],
|
|
1038
|
+
},
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
data_validation = {
|
|
1042
|
+
"schema_validation": True,
|
|
1043
|
+
"business_rules_validation": True,
|
|
1044
|
+
"referential_integrity_validation": True,
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
data_management = {
|
|
1048
|
+
"version_control": True,
|
|
1049
|
+
"backup_strategy": "daily",
|
|
1050
|
+
"retention_policy": "30d",
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
return {
|
|
1054
|
+
"test_datasets": test_datasets,
|
|
1055
|
+
"data_validation": data_validation,
|
|
1056
|
+
"data_management": data_management,
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
def manage_test_fixtures(self) -> Dict[str, Any]:
|
|
1060
|
+
"""Manage test fixtures and setup."""
|
|
1061
|
+
fixture_config = {
|
|
1062
|
+
"database_fixtures": {
|
|
1063
|
+
"users_table": {
|
|
1064
|
+
"setup": "INSERT INTO users (id, name, email) VALUES (1, 'John Doe', 'john@example.com')",
|
|
1065
|
+
"teardown": "DELETE FROM users WHERE id = 1",
|
|
1066
|
+
"cleanup": "TRUNCATE TABLE users",
|
|
1067
|
+
},
|
|
1068
|
+
"products_table": {
|
|
1069
|
+
"setup": "INSERT INTO products (id, name, price, category) "
|
|
1070
|
+
"VALUES (1, 'Product A', 19.99, 'electronics')",
|
|
1071
|
+
"teardown": "DELETE FROM products WHERE id = 1",
|
|
1072
|
+
"cleanup": "TRUNCATE TABLE products",
|
|
1073
|
+
},
|
|
1074
|
+
},
|
|
1075
|
+
"api_fixtures": {
|
|
1076
|
+
"mock_endpoints": {
|
|
1077
|
+
"/api/users": {
|
|
1078
|
+
"GET": {"status": 200, "response": {"users": []}},
|
|
1079
|
+
"POST": {
|
|
1080
|
+
"status": 201,
|
|
1081
|
+
"response": {"id": 1, "name": "New User"},
|
|
1082
|
+
},
|
|
1083
|
+
},
|
|
1084
|
+
"/api/products": {
|
|
1085
|
+
"GET": {"status": 200, "response": {"products": []}},
|
|
1086
|
+
"POST": {
|
|
1087
|
+
"status": 201,
|
|
1088
|
+
"response": {"id": 1, "name": "New Product"},
|
|
1089
|
+
},
|
|
1090
|
+
},
|
|
1091
|
+
}
|
|
1092
|
+
},
|
|
1093
|
+
"file_fixtures": {
|
|
1094
|
+
"config_files": ["app_config.json", "database_config.json"],
|
|
1095
|
+
"data_files": ["test_data.json", "expected_results.json"],
|
|
1096
|
+
"log_files": ["application.log", "error.log"],
|
|
1097
|
+
},
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
fixture_lifecycle = {
|
|
1101
|
+
"setup_order": ["database_fixtures", "api_fixtures", "file_fixtures"],
|
|
1102
|
+
"teardown_order": ["file_fixtures", "api_fixtures", "database_fixtures"],
|
|
1103
|
+
"dependency_tracking": True,
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
return {
|
|
1107
|
+
"fixture_config": fixture_config,
|
|
1108
|
+
"fixture_lifecycle": fixture_lifecycle,
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
def setup_test_environments(self) -> Dict[str, Any]:
|
|
1112
|
+
"""Setup test environments for different scenarios."""
|
|
1113
|
+
environments = {
|
|
1114
|
+
"development": {
|
|
1115
|
+
"database_url": "postgresql://localhost:5432/test_dev",
|
|
1116
|
+
"api_base_url": "http://localhost:3001",
|
|
1117
|
+
"features": ["debug_mode", "verbose_logging"],
|
|
1118
|
+
"environment_variables": {"DEBUG": "True", "LOG_LEVEL": "DEBUG"},
|
|
1119
|
+
},
|
|
1120
|
+
"staging": {
|
|
1121
|
+
"database_url": "postgresql://staging-db:5432/test_staging",
|
|
1122
|
+
"api_base_url": "http://staging.example.com",
|
|
1123
|
+
"features": ["performance_monitoring"],
|
|
1124
|
+
"environment_variables": {"DEBUG": "False", "LOG_LEVEL": "INFO"},
|
|
1125
|
+
},
|
|
1126
|
+
"production": {
|
|
1127
|
+
"database_url": "postgresql://prod-db:5432/test_prod",
|
|
1128
|
+
"api_base_url": "https://api.example.com",
|
|
1129
|
+
"features": [],
|
|
1130
|
+
"environment_variables": {"DEBUG": "False", "LOG_LEVEL": "WARNING"},
|
|
1131
|
+
},
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
environment_setup = {
|
|
1135
|
+
"setup_method": "automated",
|
|
1136
|
+
"provisioning_timeout": 300,
|
|
1137
|
+
"health_check_timeout": 60,
|
|
1138
|
+
"cleanup_method": "automated",
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
environment_isolation = {
|
|
1142
|
+
"database_isolation": True,
|
|
1143
|
+
"network_isolation": True,
|
|
1144
|
+
"filesystem_isolation": True,
|
|
1145
|
+
"process_isolation": True,
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
return {
|
|
1149
|
+
"environments": environments,
|
|
1150
|
+
"environment_setup": environment_setup,
|
|
1151
|
+
"environment_isolation": environment_isolation,
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
def cleanup_test_artifacts(self) -> Dict[str, Any]:
|
|
1155
|
+
"""Cleanup test artifacts and temporary data."""
|
|
1156
|
+
cleanup_strategies = {
|
|
1157
|
+
"database_cleanup": {
|
|
1158
|
+
"method": "truncate",
|
|
1159
|
+
"tables": ["test_data", "temp_results", "audit_logs"],
|
|
1160
|
+
"cleanup_timeout": 60,
|
|
1161
|
+
},
|
|
1162
|
+
"file_cleanup": {
|
|
1163
|
+
"method": "delete",
|
|
1164
|
+
"directories": ["temp/", "logs/", "reports/"],
|
|
1165
|
+
"file_patterns": ["*.tmp", "*.log", "test_*"],
|
|
1166
|
+
},
|
|
1167
|
+
"cache_cleanup": {
|
|
1168
|
+
"method": "flush",
|
|
1169
|
+
"caches": ["redis", "memcached", "application_cache"],
|
|
1170
|
+
"flush_timeout": 30,
|
|
1171
|
+
},
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
cleanup_schedule = {
|
|
1175
|
+
"immediate_cleanup": True,
|
|
1176
|
+
"scheduled_cleanup": "daily",
|
|
1177
|
+
"retention_period": "7d",
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
cleanup_metrics = {
|
|
1181
|
+
"cleanup_success_rate": 99.9,
|
|
1182
|
+
"average_cleanup_time": 45.2,
|
|
1183
|
+
"files_cleaned": 1250,
|
|
1184
|
+
"database_records_cleaned": 5000,
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
return {
|
|
1188
|
+
"cleanup_strategies": cleanup_strategies,
|
|
1189
|
+
"cleanup_schedule": cleanup_schedule,
|
|
1190
|
+
"cleanup_metrics": cleanup_metrics,
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
|
|
1194
|
+
class TestingMetricsCollector:
|
|
1195
|
+
"""Testing metrics collection and analysis."""
|
|
1196
|
+
|
|
1197
|
+
def __init__(self, config: Optional[Dict[str, Any]] = None):
|
|
1198
|
+
"""Initialize testing metrics collector."""
|
|
1199
|
+
self.config = config or {}
|
|
1200
|
+
self.metrics_history: List[Dict[str, Any]] = []
|
|
1201
|
+
|
|
1202
|
+
def collect_test_metrics(self) -> Dict[str, Any]:
|
|
1203
|
+
"""Collect comprehensive test metrics."""
|
|
1204
|
+
execution_metrics = {
|
|
1205
|
+
"total_tests": 1500,
|
|
1206
|
+
"passed_tests": 1320,
|
|
1207
|
+
"failed_tests": 85,
|
|
1208
|
+
"skipped_tests": 95,
|
|
1209
|
+
"execution_time": 1250.5,
|
|
1210
|
+
"avg_test_duration": 0.83,
|
|
1211
|
+
"test_throughput": 1.2,
|
|
1212
|
+
"concurrent_tests": 4,
|
|
1213
|
+
"queue_wait_time": 12.5,
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
quality_metrics = {
|
|
1217
|
+
"coverage_percentage": 85.0,
|
|
1218
|
+
"code_quality_score": 8.7,
|
|
1219
|
+
"maintainability_index": 8.2,
|
|
1220
|
+
"testability_score": 9.1,
|
|
1221
|
+
"complexity_score": 6.8,
|
|
1222
|
+
"duplication_percentage": 2.3,
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
performance_metrics = {
|
|
1226
|
+
"avg_test_duration": 0.83,
|
|
1227
|
+
"max_test_duration": 5.2,
|
|
1228
|
+
"min_test_duration": 0.05,
|
|
1229
|
+
"test_flakiness": 0.056,
|
|
1230
|
+
"test_reliability": 0.944,
|
|
1231
|
+
"performance_regression": False,
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
team_metrics = {
|
|
1235
|
+
"test_author_count": 15,
|
|
1236
|
+
"avg_tests_per_author": 100,
|
|
1237
|
+
"test_maintenance_time": 20.5,
|
|
1238
|
+
"test_review_time": 45.2,
|
|
1239
|
+
"test_failure_response_time": 2.5,
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
return {
|
|
1243
|
+
"execution_metrics": execution_metrics,
|
|
1244
|
+
"quality_metrics": quality_metrics,
|
|
1245
|
+
"performance_metrics": performance_metrics,
|
|
1246
|
+
"team_metrics": team_metrics,
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
def calculate_quality_scores(self) -> Dict[str, Any]:
|
|
1250
|
+
"""Calculate comprehensive quality scores."""
|
|
1251
|
+
weights = {
|
|
1252
|
+
"coverage": 0.3,
|
|
1253
|
+
"code_quality": 0.25,
|
|
1254
|
+
"test_reliability": 0.2,
|
|
1255
|
+
"performance": 0.15,
|
|
1256
|
+
"maintainability": 0.1,
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
raw_scores = {
|
|
1260
|
+
"coverage": 85.0,
|
|
1261
|
+
"code_quality": 87.0,
|
|
1262
|
+
"test_reliability": 94.4,
|
|
1263
|
+
"performance": 88.0,
|
|
1264
|
+
"maintainability": 82.0,
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
weighted_scores = {
|
|
1268
|
+
"coverage_score": raw_scores["coverage"] * weights["coverage"],
|
|
1269
|
+
"code_quality_score": raw_scores["code_quality"] * weights["code_quality"],
|
|
1270
|
+
"test_reliability_score": raw_scores["test_reliability"] * weights["test_reliability"],
|
|
1271
|
+
"performance_score": raw_scores["performance"] * weights["performance"],
|
|
1272
|
+
"maintainability_score": raw_scores["maintainability"] * weights["maintainability"],
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
overall_score = sum(weighted_scores.values())
|
|
1276
|
+
|
|
1277
|
+
grade = "A" if overall_score >= 90 else "B" if overall_score >= 80 else "C" if overall_score >= 70 else "D"
|
|
1278
|
+
|
|
1279
|
+
recommendations = [
|
|
1280
|
+
"Improve maintainability score (82.0) - focus on code refactoring",
|
|
1281
|
+
"Increase code quality score (87.0) - address pylint issues",
|
|
1282
|
+
"Maintain test reliability (94.4) - current level is excellent",
|
|
1283
|
+
]
|
|
1284
|
+
|
|
1285
|
+
return {
|
|
1286
|
+
"weights": weights,
|
|
1287
|
+
"raw_scores": raw_scores,
|
|
1288
|
+
"weighted_scores": weighted_scores,
|
|
1289
|
+
"overall_score": overall_score,
|
|
1290
|
+
"grade": grade,
|
|
1291
|
+
"recommendations": recommendations,
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
def track_test_efficiency(self) -> Dict[str, Any]:
|
|
1295
|
+
"""Track test efficiency and productivity."""
|
|
1296
|
+
efficiency_metrics = {
|
|
1297
|
+
"test_execution_efficiency": 92.5,
|
|
1298
|
+
"test_maintenance_efficiency": 88.3,
|
|
1299
|
+
"test_creation_efficiency": 85.7,
|
|
1300
|
+
"overall_efficiency": 88.8,
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
productivity_metrics = {
|
|
1304
|
+
"tests_per_hour": 12.5,
|
|
1305
|
+
"test_maintenance_time_per_test": 2.5,
|
|
1306
|
+
"test_review_time_per_test": 3.2,
|
|
1307
|
+
"test_failure_resolution_time": 1.8,
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
efficiency_trends = {
|
|
1311
|
+
"execution_efficiency_trend": [88.0, 90.2, 92.5],
|
|
1312
|
+
"maintenance_efficiency_trend": [85.0, 86.7, 88.3],
|
|
1313
|
+
"creation_efficiency_trend": [82.0, 83.9, 85.7],
|
|
1314
|
+
"overall_efficiency_trend": [85.0, 86.9, 88.8],
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
efficiency_benchmarks = {
|
|
1318
|
+
"industry_standard": 85.0,
|
|
1319
|
+
"best_practice": 95.0,
|
|
1320
|
+
"current_position": 88.8,
|
|
1321
|
+
"improvement_potential": 6.2,
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
return {
|
|
1325
|
+
"efficiency_metrics": efficiency_metrics,
|
|
1326
|
+
"productivity_metrics": productivity_metrics,
|
|
1327
|
+
"efficiency_trends": efficiency_trends,
|
|
1328
|
+
"efficiency_benchmarks": efficiency_benchmarks,
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
def generate_test_analytics(self) -> Dict[str, Any]:
|
|
1332
|
+
"""Generate comprehensive test analytics."""
|
|
1333
|
+
analytics_report = {
|
|
1334
|
+
"executive_summary": {
|
|
1335
|
+
"total_test_suite_size": 1500,
|
|
1336
|
+
"health_score": 88.8,
|
|
1337
|
+
"key_findings": [
|
|
1338
|
+
"Test suite is well-maintained with good coverage",
|
|
1339
|
+
"Performance is stable with no regressions",
|
|
1340
|
+
"Team productivity is above industry average",
|
|
1341
|
+
],
|
|
1342
|
+
"critical_insights": [
|
|
1343
|
+
"Focus on improving maintainability",
|
|
1344
|
+
"Address test flakiness issues",
|
|
1345
|
+
"Increase automation coverage",
|
|
1346
|
+
],
|
|
1347
|
+
},
|
|
1348
|
+
"detailed_analytics": {
|
|
1349
|
+
"test_distribution": {
|
|
1350
|
+
"unit_tests": 53.3,
|
|
1351
|
+
"integration_tests": 30.0,
|
|
1352
|
+
"e2e_tests": 10.0,
|
|
1353
|
+
"performance_tests": 6.7,
|
|
1354
|
+
},
|
|
1355
|
+
"test_quality": {
|
|
1356
|
+
"pass_rate": 88.0,
|
|
1357
|
+
"coverage_rate": 85.0,
|
|
1358
|
+
"stability_rate": 94.4,
|
|
1359
|
+
},
|
|
1360
|
+
"performance_analysis": {
|
|
1361
|
+
"avg_execution_time": 0.83,
|
|
1362
|
+
"throughput": 1.2,
|
|
1363
|
+
"concurrent_efficiency": 92.5,
|
|
1364
|
+
},
|
|
1365
|
+
},
|
|
1366
|
+
"actionable_insights": [
|
|
1367
|
+
"Prioritize test refactoring for better maintainability",
|
|
1368
|
+
"Implement continuous monitoring for test performance",
|
|
1369
|
+
"Increase integration test coverage by 15%",
|
|
1370
|
+
"Address test flakiness in 5 critical test suites",
|
|
1371
|
+
],
|
|
1372
|
+
"future_predictions": {
|
|
1373
|
+
"test_suite_growth": "20% increase next quarter",
|
|
1374
|
+
"quality_improvement": "5% improvement in overall score",
|
|
1375
|
+
"automation_benefits": "30% reduction in manual testing effort",
|
|
1376
|
+
},
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
return analytics_report
|
|
1380
|
+
|
|
1381
|
+
|
|
1382
|
+
# Utility functions
|
|
1383
|
+
def generate_test_report(results: List[TestResult]) -> Dict[str, Any]:
|
|
1384
|
+
"""Generate a comprehensive test report from test results."""
|
|
1385
|
+
total_tests = len(results)
|
|
1386
|
+
passed_tests = len([r for r in results if r.status == TestStatus.PASSED])
|
|
1387
|
+
failed_tests = len([r for r in results if r.status == TestStatus.FAILED])
|
|
1388
|
+
skipped_tests = len([r for r in results if r.status == TestStatus.SKIPPED])
|
|
1389
|
+
|
|
1390
|
+
total_duration = sum(r.duration for r in results)
|
|
1391
|
+
avg_duration = total_duration / total_tests if total_tests > 0 else 0
|
|
1392
|
+
|
|
1393
|
+
return {
|
|
1394
|
+
"summary": {
|
|
1395
|
+
"total_tests": total_tests,
|
|
1396
|
+
"passed_tests": passed_tests,
|
|
1397
|
+
"failed_tests": failed_tests,
|
|
1398
|
+
"skipped_tests": skipped_tests,
|
|
1399
|
+
"pass_rate": (passed_tests / total_tests * 100) if total_tests > 0 else 0,
|
|
1400
|
+
"total_duration": total_duration,
|
|
1401
|
+
"average_duration": avg_duration,
|
|
1402
|
+
},
|
|
1403
|
+
"details": [asdict(r) for r in results],
|
|
1404
|
+
"generated_at": datetime.now().isoformat(),
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
|
|
1408
|
+
def export_test_results(results: Dict[str, Any], format: str = "json") -> str:
|
|
1409
|
+
"""Export test results in various formats."""
|
|
1410
|
+
if format == "json":
|
|
1411
|
+
return json.dumps(results, indent=2, default=str)
|
|
1412
|
+
elif format == "xml":
|
|
1413
|
+
# Simple XML conversion
|
|
1414
|
+
xml_lines = ["<test_results>"]
|
|
1415
|
+
xml_lines.append(f"<summary>{json.dumps(results['summary'])}</summary>")
|
|
1416
|
+
xml_lines.append("<details>")
|
|
1417
|
+
for result in results["details"]:
|
|
1418
|
+
xml_lines.append(
|
|
1419
|
+
f'<test name="{result["name"]}" status="{result["status"]}" duration="{result["duration"]}"/>'
|
|
1420
|
+
)
|
|
1421
|
+
xml_lines.append("</details>")
|
|
1422
|
+
xml_lines.append("</test_results>")
|
|
1423
|
+
return "\n".join(xml_lines)
|
|
1424
|
+
else:
|
|
1425
|
+
raise ValueError(f"Unsupported format: {format}")
|
|
1426
|
+
|
|
1427
|
+
|
|
1428
|
+
def validate_test_configuration(config: Dict[str, Any]) -> Dict[str, Any]:
|
|
1429
|
+
"""Validate test configuration and return validation results."""
|
|
1430
|
+
validation_results: Dict[str, Any] = {
|
|
1431
|
+
"is_valid": True,
|
|
1432
|
+
"errors": [],
|
|
1433
|
+
"warnings": [],
|
|
1434
|
+
"recommendations": [],
|
|
1435
|
+
}
|
|
1436
|
+
|
|
1437
|
+
# Validate required fields
|
|
1438
|
+
required_fields = ["frameworks", "test_paths", "thresholds"]
|
|
1439
|
+
for field in required_fields:
|
|
1440
|
+
if field not in config:
|
|
1441
|
+
validation_results["errors"].append(f"Missing required field: {field}")
|
|
1442
|
+
validation_results["is_valid"] = False
|
|
1443
|
+
|
|
1444
|
+
# Validate thresholds
|
|
1445
|
+
if "thresholds" in config:
|
|
1446
|
+
thresholds = config["thresholds"]
|
|
1447
|
+
if "min_coverage" in thresholds and thresholds["min_coverage"] > 100:
|
|
1448
|
+
validation_results["errors"].append("Minimum coverage cannot exceed 100%")
|
|
1449
|
+
validation_results["is_valid"] = False
|
|
1450
|
+
|
|
1451
|
+
if "max_duration" in thresholds and thresholds["max_duration"] <= 0:
|
|
1452
|
+
validation_results["errors"].append("Maximum duration must be positive")
|
|
1453
|
+
validation_results["is_valid"] = False
|
|
1454
|
+
|
|
1455
|
+
# Validate test paths
|
|
1456
|
+
if "test_paths" in config:
|
|
1457
|
+
test_paths = config["test_paths"]
|
|
1458
|
+
for path in test_paths:
|
|
1459
|
+
if not os.path.exists(path):
|
|
1460
|
+
validation_results["warnings"].append(f"Test path does not exist: {path}")
|
|
1461
|
+
|
|
1462
|
+
# Generate recommendations
|
|
1463
|
+
if validation_results["is_valid"]:
|
|
1464
|
+
validation_results["recommendations"].append("Configuration is valid and ready for use")
|
|
1465
|
+
validation_results["recommendations"].append("Consider adding performance monitoring for production")
|
|
1466
|
+
validation_results["recommendations"].append("Implement test result archiving for compliance")
|
|
1467
|
+
|
|
1468
|
+
return validation_results
|
|
1469
|
+
|
|
1470
|
+
|
|
1471
|
+
# Main execution function
|
|
1472
|
+
def main():
|
|
1473
|
+
"""Main function for testing framework demonstration."""
|
|
1474
|
+
print("MoAI Domain Testing Framework Demo")
|
|
1475
|
+
print("=" * 50)
|
|
1476
|
+
|
|
1477
|
+
# Initialize managers
|
|
1478
|
+
framework_manager = TestingFrameworkManager()
|
|
1479
|
+
quality_engine = QualityGateEngine()
|
|
1480
|
+
coverage_analyzer = CoverageAnalyzer()
|
|
1481
|
+
automation_orchestrator = TestAutomationOrchestrator()
|
|
1482
|
+
reporting_specialist = TestReportingSpecialist()
|
|
1483
|
+
data_manager = TestDataManager()
|
|
1484
|
+
metrics_collector = TestingMetricsCollector()
|
|
1485
|
+
|
|
1486
|
+
# Demonstrate key functionalities
|
|
1487
|
+
print("\n1. Testing Framework Configuration:")
|
|
1488
|
+
pytest_config = framework_manager.configure_pytest_environment()
|
|
1489
|
+
print(f"Pytest configuration: {len(pytest_config)} sections")
|
|
1490
|
+
|
|
1491
|
+
print("\n2. Quality Gate Setup:")
|
|
1492
|
+
quality_config = quality_engine.setup_code_quality_checks()
|
|
1493
|
+
print(f"Quality checks: {len(quality_config['linters'])} linters configured")
|
|
1494
|
+
|
|
1495
|
+
print("\n3. Coverage Analysis:")
|
|
1496
|
+
coverage_report = coverage_analyzer.analyze_code_coverage()
|
|
1497
|
+
print(f"Coverage: {coverage_report['summary']['percentage']}% lines covered")
|
|
1498
|
+
|
|
1499
|
+
print("\n4. CI Pipeline Configuration:")
|
|
1500
|
+
ci_config = automation_orchestrator.setup_ci_pipeline()
|
|
1501
|
+
print(f"CI pipeline: {len(ci_config['stages'])} stages configured")
|
|
1502
|
+
|
|
1503
|
+
print("\n5. Test Reporting:")
|
|
1504
|
+
test_report = reporting_specialist.generate_test_reports()
|
|
1505
|
+
print(f"Test results: {test_report['summary']['total_tests']} tests executed")
|
|
1506
|
+
|
|
1507
|
+
print("\n6. Test Data Management:")
|
|
1508
|
+
datasets = data_manager.create_test_datasets()
|
|
1509
|
+
print(f"Test datasets: {len(datasets['test_datasets'])} dataset types")
|
|
1510
|
+
|
|
1511
|
+
print("\n7. Metrics Collection:")
|
|
1512
|
+
metrics = metrics_collector.collect_test_metrics()
|
|
1513
|
+
print(f"Metrics collected: {len(metrics)} metric categories")
|
|
1514
|
+
|
|
1515
|
+
print("\n8. Quality Scores:")
|
|
1516
|
+
quality_scores = metrics_collector.calculate_quality_scores()
|
|
1517
|
+
print(f"Overall quality grade: {quality_scores['grade']}")
|
|
1518
|
+
|
|
1519
|
+
print("\nDemo completed successfully!")
|
|
1520
|
+
return True
|
|
1521
|
+
|
|
1522
|
+
|
|
1523
|
+
if __name__ == "__main__":
|
|
1524
|
+
main()
|