Skip to content

developer testing

MD MUFTHAKHERUL ISLAM MIRAZ edited this page Jun 17, 2026 · 2 revisions

Testing

Siyarix maintains a comprehensive test suite with pytest (asyncio_mode=auto) targeting 75%+ code coverage across all modules.

Framework

  • pytest with pytest-asyncio (auto mode) for async test support
  • pytest-cov for coverage reporting
  • Custom markers: bootstrap, cvss, report, stealth, terminal, tool_installer, e2e, integration

Running tests

pytest                              # All tests
pytest --cov=siyarix                # With coverage
pytest tests/test_planner.py        # Specific file
pytest -k "provider"                # Keyword match
pytest -v                           # Verbose
pytest -x                           # Stop on first failure
pytest -n auto                      # Parallel execution
pytest -m "not integration"         # Unit tests only

Test structure

Tests mirror the source structure in tests/:

tests/
├── conftest.py                        # Shared fixtures
├── test_core.py                       # Core agent tests
├── test_core_components.py            # Component-level core tests
├── test_cli_main.py                   # CLI tests
├── test_e2e.py                        # End-to-end tests
├── test_e2e_simulation.py             # Simulated E2E tests
├── test_stress_resilience.py          # Stress/resilience tests
├── test_providers.py                  # Provider tests
├── test_providers_manager.py          # ProviderManager tests
├── test_providers_state.py            # State manager tests
├── test_providers_types.py            # Type system tests
├── test_providers_usage.py            # Usage tracking tests
├── test_planner.py                    # Planner router tests
├── test_planner_autonomous.py         # Autonomous planner tests
├── test_planner_registry.py           # Registry planner tests
├── test_executor.py                   # Executor tests
├── test_executor_autonomous.py        # Autonomous executor tests
├── test_credential_store.py           # Credential vault tests
├── test_permission_gate.py            # Permission gate tests
├── test_audit_chain.py                # Audit trail tests
├── test_knowledge_graph.py            # Knowledge graph tests
├── test_config.py                     # Config tests
├── test_cache_manager.py              # Cache tests
├── test_compaction.py                 # Compaction tests
├── test_compat_models.py              # Compatibility model tests
├── test_connectivity.py               # Connectivity tests
├── test_cvss_scorer.py                # CVSS scoring tests
├── test_events.py                     # Event bus tests
├── test_exceptions.py                 # Exception hierarchy tests
├── test_health.py                     # Health check tests
├── test_memory.py                     # Memory tests
├── test_metrics.py                    # Metrics tests
├── test_models.py                     # Model tests
├── test_model_aliases.py              # Model alias tests
├── test_nlp_engine.py                 # NLP engine tests
├── test_notifications.py              # Notification tests
├── test_offline_store.py              # Offline store tests
├── test_ollama_utils.py               # Ollama utility tests
├── test_onboarding.py                 # Onboarding tests
├── test_opsec.py                      # OPSEC tests
├── test_output_config.py              # Output config tests
├── test_output_init.py                # Output engine tests
├── test_performance.py                # Performance tests
├── test_personas.py                   # Persona tests
├── test_playbook.py                   # Playbook tests
├── test_plugins_loader.py             # Plugin loader tests
├── test_provider_utils.py             # Provider utility tests
├── test_registry.py                   # Tool registry tests
├── test_report_engine.py              # Report engine tests
├── test_response_generator.py         # Response generator tests
├── test_security_commands.py          # Security command tests
├── test_security_hardening.py         # Hardening tests
├── test_session_branching.py          # Session branching tests
├── test_session_kernel.py             # Session kernel tests
├── test_session_log.py                # Session log tests
├── test_shell_review.py               # Shell review tests
├── test_stealth.py                    # Stealth tests
├── test_subprocess_safe_run.py        # Subprocess safety tests
├── test_subprocess_utils.py           # Subprocess utility tests
├── test_threat_intel.py               # Threat intel tests
├── test_tool_availability.py          # Tool availability tests
├── test_tool_call_repair.py           # Tool call repair tests
├── test_tool_graph.py                 # Tool graph tests
├── test_tool_handlers.py              # Tool handler tests
├── test_engine_context.py             # Engine context tests
├── test_engine_executor.py            # Engine executor tests
├── test_engine_providers.py           # Engine provider tests
├── test_engine_safety.py              # Engine safety tests
├── test_execution_engine.py           # Execution engine tests
├── test_chat.py                       # Chat tests
├── test_chat_engine.py                # Chat engine tests
├── test_chat_handlers.py              # Chat handler tests
├── test_chat_openai_compat.py         # OpenAI compat tests
├── test_bootstrap.py                  # Bootstrap tests
├── test_branding.py                   # Branding tests
├── test_intent_router.py              # Intent router tests
├── test_autonomous_loop.py            # Autonomous loop tests
├── test_main.py                       # Main entry tests
├── test_logging_config.py             # Logging config tests
├── test_parsers/                      # Parser test suite
│   ├── test_nmap_parser.py
│   ├── test_nuclei_parser.py
│   ├── test_parsers_ad_windows.py
│   ├── test_parsers_boundary.py
│   ├── test_parsers_cloud_security.py
│   ├── test_parsers_dns_recon.py
│   ├── test_parsers_gobuster.py
│   ├── test_parsers_network.py
│   ├── test_parsers_nmap.py
│   ├── test_parsers_registry.py
│   ├── test_parsers_web_fuzz.py
│   ├── test_parsers_web_vuln.py
│   └── ... (80+ individual parser tests)
├── scripts/                           # Test helper scripts
└── ...

Writing tests

Async tests

import pytest

@pytest.mark.asyncio
async def test_async_behavior():
    result = await some_async_function()
    assert result is not None

Mocking providers

@pytest.mark.asyncio
async def test_planner_with_mock_provider():
    planner = TaskPlanner()
    planner.providers = [MockProvider()]
    result = await planner.plan("scan test")
    assert result is not None

Using fixtures

@pytest.fixture
def temp_config(tmp_path):
    config_path = tmp_path / "settings.toml"
    config_path.write_text('[default]\nkey = "value"')
    os.environ["SIYARIX_CONFIG"] = str(config_path)
    yield config_path
    del os.environ["SIYARIX_CONFIG"]

Coverage

pytest --cov=siyarix --cov-report=term-missing

Coverage is enforced in CI via pyproject.toml (fail_under = 75).

Code quality

ruff check src/ tests/               # Lint
ruff check --fix src/ tests/         # Auto-fix
ruff format src/ tests/              # Format
mypy src/siyarix/                    # Type check (strict mode)
vulture src/siyarix/                 # Dead code detection
bandit -r src/siyarix/               # Security scan

CI matrix

Tests run on every PR and push to main via GitHub Actions:

Dimension Values
Python 3.11, 3.12, 3.13
OS ubuntu-latest, windows-latest, macos-latest
Tests Unit + integration + E2E
Lint Ruff + MyPy
Security Bandit (SARIF), pip-audit (critical/high fail)
Compatibility Build sdist/wheel, check-wheel-contents, twine check

Pre-commit hooks

pre-commit install

Runs Ruff, MyPy, and other checks before each commit. Configuration in .pre-commit-config.yaml.

Note

👋 Welcome to Siyarix! This is a personal passion project built by a single developer. It's currently under active development and growing fast. Expect rough edges, but lots of love! ❤️

🗺️ Siyarix Documentation Map

Welcome to the Siyarix Documentation Map! This page serves as your master compass for navigating the extensive documentation we have built for the platform.

Whether you are a brand new user, a seasoned security operator, or a developer looking to contribute to the core engine, you can find exactly what you need here.


🧭 Quick Navigation

Not sure where to start? Pick the path that best describes you:

🌱 For New Users

Just getting started? We highly recommend following these guides in order:

  1. Installation Guide — Get Siyarix running on your machine.
  2. Onboarding Wizard — Let our interactive wizard help you set up your API keys and environment.
  3. Setup & Configuration — A deeper dive into customizing your setup.
  4. Your First Run — A gentle walkthrough of your very first Siyarix command.

🛡️ For Security Operators

Ready to put Siyarix to work? Dive into our operational guides:

💻 For Developers & Contributors

Looking under the hood or wanting to write some code? Start here:


📂 The Complete Documentation Tree

If you prefer to browse the raw structure, here is a complete layout of the docs/ folder:

docs/
├── 🚀 getting-started/       # Installation, onboarding, and configuration
│   ├── installation.md       # Multi-platform install (pip, brew, winget, docker)
│   ├── onboarding.md         # The interactive 11-step setup wizard
│   ├── setup.md              # Managing API keys, credentials, and settings
│   ├── first-run.md          # A walkthrough of your first session
│   ├── configuration.md      # A deep-dive into advanced settings
│   └── troubleshooting.md    # Common issues and how to fix them instantly
│
├── 📖 user/                  # Daily operations and workflows
│   ├── cli-commands.md       # Reference for 50+ CLI commands across 12 groups
│   ├── interactive-chat.md   # Mastering the AI REPL and 54+ slash commands
│   ├── security-workflows.md # Recon, vulnerability assessment, incident response
│   ├── cloud-scanning.md     # Multi-cloud security scanning (under development)
│   ├── compliance.md         # Framework mapping (SOC 2, NIST, GDPR, PCI-DSS)
│   ├── threat-intelligence.md# Integrations with OTX, NVD, and MITRE ATT&CK
│   ├── playbooks.md          # Building automated YAML-based IR playbooks
│   ├── workflow-files.md     # DAG workflow reference (programmatic API)
│   ├── reporting.md          # Multi-format report generation
│   ├── offline-registry.md   # Running without AI (Offline/Registry execution mode)
│   └── ai-workflows.md       # Advanced AI-driven autonomous operations
│
├── 💻 developer/             # Building, testing, and extending Siyarix
│   ├── codebase-overview.md  # Full module structure mapping
│   ├── contribution-guide.md # How to submit PRs and our coding standards
│   ├── module-architecture.md# Component design and responsibilities
│   ├── testing.md            # Writing tests (pytest), coverage, and CI/CD
│   └── building.md           # Packaging, distribution, and Docker builds
│
├── 🏗️ architecture/          # System design and core internals
│   ├── overview.md           # High-level data flow and layered orchestration
│   ├── ai-agent-pipeline.md  # The AgentCore reasoning and execution pipeline
│   ├── provider-abstraction.md# How we unify 26 different AI providers
│   ├── execution-engine.md   # Plan-based step orchestration
│   ├── memory-and-state.md   # Knowledge graph, session persistence, and learning
│   ├── security-model.md     # The Permission Gate, DLP, audit logging, and OPSEC
│   └── intent-routing.md     # Semantic intent classification and routing
│
├── 🧠 ai/                    # Deep dive into the AI provider & agent systems
│   ├── routing.md            # Managing 26 providers, failovers, and circuit breakers
│   ├── persona-system.md     # Overview of our 10 security personas
│   ├── agent-reasoning.md    # The Observe-Reason-Act loop and tool call repair
│   ├── tool-execution.md     # The tool registry, capability graph, and parsers
│   ├── ensemble.md           # Parallel LLM voting strategies
│   ├── multi-wave.md         # Iterative goal execution with context carry-over
│   ├── prompt-architecture.md# System prompt design and management
│   └── safety.md             # Our rigorous 8-layer hallucination mitigation system
│
├── 🛡️ security/              # Safety, ethics, and threat models
│   ├── reporting.md          # How to safely report vulnerabilities to us
│   ├── threat-model.md       # System threat model and our mitigations
│   ├── operational-security.md# TOR routing, stealth modes, and OPSEC controls
│   ├── ethical-policy.md     # Mandatory rules of engagement for all users
│   └── abuse-prevention.md   # How we prevent misuse of the AI engine
│
└── ⚖️ legal/                 # Licensing and governance
    ├── agpl-guide.md         # A plain-English overview of the AGPL-3.0-or-later license
    ├── why-agpl.md           # The philosophy behind our license choice
    ├── trademark-policy.md   # Branding and trademark guidelines
    ├── responsible-ai.md     # Our framework for ethical AI usage
    ├── disclaimer.md         # Important legal disclaimers
    └── plugin-exception.md   # The license exception for building custom plugins

📖 Key Terminology

As you read through the documentation, you might encounter some specific terms. Here is a quick cheat sheet:

Term What It Means
Provider The backend AI engine powering Siyarix (e.g., OpenAI, Anthropic, Ollama).
Tool A traditional security executable installed on your system (e.g., nmap, nuclei).
Plan A step-by-step sequence of tool commands intelligently generated by the AI.
Workflow A hardcoded, predefined execution path (usually defined in YAML/JSON) that doesn't require AI generation.
Persona A specialized behavioral profile given to the AI (e.g., instructing it to act specifically as a "Network Recon Specialist").
Knowledge Graph Siyarix's internal memory where it stores findings (like IP addresses, open ports) to contextually inform future steps.

Need help finding something specific? Feel free to use the search bar at the top of the documentation site, or open a discussion on our GitHub!

Clone this wiki locally