Skip to main content
Glama

🚀 Karateフィーチャーグラフアナライザー

Karateフレームワークのフィーチャーファイルを解析し、インタラクティブな依存関係グラフを生成するための強力なMCP(Model Context Protocol)ツールです。

Python Tests License


📋 目次


Related MCP server: GID MCP Server

✨ 機能

主要機能

  • 🔍 フィーチャーファイルの解析 - Gherkin構文を使用したKarateフィーチャーファイルの解析

  • 🎯 依存関係分析 - 依存関係(ワークフロー、API、ページ、DB)の抽出と分析

  • 📊 インタラクティブな可視化 - 凡例付きの美しいHTMLグラフの生成

  • 🎫 Jira統合 - Jiraタグ(@PROJ-123)の抽出と追跡

  • 🔄 影響分析 - コンポーネント変更時に影響を受けるテストケースの特定

  • 📈 マルチプロジェクトサポート - 複数のプロジェクトの管理と分析

  • 💾 エクスポート/インポート - JSON/GraphML形式へのグラフのエクスポート

  • パフォーマンス最適化 - キャッシュとインデックスによる高速な分析

可視化機能

  • 🎨 タイプ別の色分けノード(テスト、ワークフロー、API、ページ、データベース)

  • 🔍 メタデータ付きのインタラクティブなツールチップ(ファイルパス、行番号、Jiraタグ)

  • 🖱️ クリックによるハイライト(接続と依存関係)

  • 📊 凡例(右上隅に色と形状の説明を表示)

  • 🔄 物理シミュレーション(自動レイアウト用)

  • 🎯 影響ビュー(変更されたコンポーネントと影響を受けるテストを強調表示)


🚀 クイックスタート

1. 依存関係のインストール

pip install -e .
pip install pyvis  # For visualization

2. デモの実行

# Set UTF-8 encoding (Windows)
$env:PYTHONIOENCODING="utf-8"

# Run large project demo
python test_large_project.py

3. 結果の表示

cd output
start ecommerce-platform_full.html

📦 インストール

前提条件

  • Python 3.8以上

  • pipパッケージマネージャー

ソースからのインストール

# Clone repository
git clone <repository-url>
cd karate-feature-graph-analyzer

# Install dependencies
pip install -e .

# Install visualization library
pip install pyvis

# Verify installation
pytest tests/ -v

依存関係

コア依存関係(自動インストール):

  • networkx - グラフ操作

  • hypothesis - プロパティベースのテスト

  • pydantic - データ検証

オプションの依存関係:

  • pyvis - インタラクティブな可視化


💻 使い方

基本的な使い方

from karate_graph_analyzer.mcp_interface.mcp_tool import KarateGraphAnalyzerTool

# Initialize tool
tool = KarateGraphAnalyzerTool()

# Register project
tool.register_project(
    name="my-project",
    root_path="/path/to/karate/project",
    feature_file_patterns=["**/*.feature"]
)

# Analyze project
analysis = tool.analyze_project("my-project")
print(f"Found {analysis['statistics']['total_nodes']} nodes")

# Query dependencies
deps = tool.query_dependencies("tc_0001", transitive=True)
print(f"Found {deps['count']} dependencies")

# Impact analysis
impact = tool.impact_analysis("api_0001")
print(f"Affected: {impact['total_count']} test cases")

# Export graph
export = tool.export_graph("my-project", format="json")
with open("graph.json", "w") as f:
    f.write(export['data'])

可視化

from karate_graph_analyzer.visualization.graph_visualizer import GraphVisualizer

# Get graph
graph = tool.graphs["my-project"]

# Create visualizer
visualizer = GraphVisualizer(graph)

# Render full graph
visualizer.render("output/graph.html", height="900px")

# Render impact view
visualizer.render_impact_view(
    changed_component_id="api_0001",
    affected_test_case_ids=["tc_0001", "tc_0002"],
    output_path="output/impact.html"
)

コマンドライン(スクリプト経由)

# Analyze large project
python test_large_project.py

# Output will be in output/ directory:
# - ecommerce-platform_full.html (full graph)
# - ecommerce-platform_impact.html (impact view)
# - ecommerce-platform_graph.json (graph data)
# - LARGE_PROJECT_ANALYSIS_REPORT.md (detailed report)

📁 プロジェクト構造

karate-feature-graph-analyzer/
├── src/karate_graph_analyzer/
│   ├── models.py                    # Data models
│   ├── parser/                      # Feature file parsing
│   │   └── feature_parser.py
│   ├── graph/                       # Graph construction
│   │   └── graph_builder.py
│   ├── analyzer/                    # Dependency analysis
│   │   └── dependency_analyzer.py
│   ├── mcp_interface/               # MCP protocol
│   │   └── mcp_tool.py
│   ├── storage/                     # Project registry
│   │   └── project_registry.py
│   ├── cache/                       # AST caching
│   │   └── cache_manager.py
│   ├── visualization/               # Graph visualization
│   │   └── graph_visualizer.py
│   └── logging_config.py            # Logging setup
│
├── tests/
│   ├── unit/                        # 306 unit tests
│   ├── integration/                 # Integration tests
│   └── fixtures/                    # Test data
│
├── output/                          # Generated files
│   ├── ecommerce-platform_full.html
│   ├── ecommerce-platform_impact.html
│   ├── ecommerce-platform_graph.json
│   ├── LARGE_PROJECT_ANALYSIS_REPORT.md
│   └── README.md
│
├── test_project_demo/               # Small demo project
├── test_project_large/              # Large demo project (e-commerce)
├── examples/                        # Usage examples
├── docs/                            # Documentation
│   ├── API.md
│   └── jira_tag_extraction.md
│
├── test_large_project.py            # Demo script
├── pyproject.toml                   # Project config
├── pytest.ini                       # Test config
└── README.md                        # This file

📚 ドキュメント

コアドキュメント

仕様


🎯 例

例1: デモプロジェクトの分析

# Run demo
python test_large_project.py

# View results
cd output
start ecommerce-platform_full.html

表示内容:

  • 84ノード(73テストケース、6ワークフロー、3ページ、1 API、1 DB)

  • 26エッジ(依存関係)

  • 凡例付きのインタラクティブなグラフ

  • タイプ別の色分け

  • メタデータ付きのホバーツールチップ

例2: 影響分析

# Find what tests are affected by API change
impact = tool.impact_analysis("api_0001")

print(f"Changed: {impact['changed_component']}")
print(f"Affected: {impact['total_count']} test cases")

for tc in impact['affected_test_cases']:
    print(f"  - {tc['name']} (depth: {tc['depth']})")
    if tc['jira_tags']:
        print(f"    Jira: {', '.join(tc['jira_tags'])}")

出力:

Changed: api_0001
Affected: 14 test cases
  - Successful login (depth: 1)
    Jira: @AUTH-101
  - Get user profile (depth: 1)
    Jira: @USER-101
  ...

例3: 共通コンポーネントの検索

# Find reusable components across projects
common = tool.find_common_components(["project1", "project2"])

for comp in common['components']:
    print(f"{comp['component_type']}: {comp['identifier']}")
    print(f"  Used in {comp['usage_count']} projects")
    print(f"  Projects: {', '.join(comp['projects'])}")

🧪 テスト

すべてのテストを実行

# Run all tests
pytest tests/ -v

# Run specific test suite
pytest tests/unit/ -v
pytest tests/integration/ -v

# Run with coverage
pytest tests/ --cov=src/karate_graph_analyzer --cov-report=html

テスト統計

  • テスト総数: 306

  • 成功: 306 (100%)

  • 失敗: 0

  • スキップ: 1

  • カバレッジ: 包括的

テストカテゴリ

  • ユニットテスト (tests/unit/) - 個々のコンポーネントのテスト

  • 統合テスト (tests/integration/) - コンポーネント間の相互作用のテスト

  • プロパティテスト (オプション) - Hypothesisを使用したプロパティベースのテスト


🎨 可視化ガイド

凡例の理解

可視化HTMLファイルを開くと、右上隅に凡例が表示されます:

📊 Legend
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🟢 Test Case - Scenario hoặc test
🔵 Workflow - Reusable workflow
🟠 API - API endpoint
🟣 Page - Page object
🔴 Database - Database operation
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
💡 Tip: Hover để xem chi tiết
🖱️ Click để highlight connections
🔍 Scroll để zoom in/out

インタラクティブ機能

  1. ホバー - ノードにマウスを合わせると、以下が表示されます:

    • ノード名

    • ノードタイプ

    • ファイルパス

    • 行番号

    • Jiraタグ

  2. クリック - ノードをクリックすると、以下がハイライトされます:

    • 選択されたノード

    • 接続されているすべてのノード

    • すべての接続エッジ

  3. ズーム - マウスホイールをスクロールして拡大/縮小

  4. パン - 背景をドラッグして移動

  5. 再配置 - ノードをドラッグしてレイアウトを調整


🔧 設定

パーサー設定

from karate_graph_analyzer.models import ParserConfig

config = ParserConfig(
    jira_tag_patterns=[
        r'@[A-Z]+-\d+',      # @PROJ-123
        r'@[a-z]+-\d+',      # @proj-123
        r'@[A-Z]+_\d+',      # @PROJ_123
    ],
    workflow_directories=['workflows', 'common'],
    page_object_directories=['pages', 'page-objects'],
    variable_patterns=[r'\$\{(\w+)\}'],
    api_extraction_rules={
        'extract_from_variables': True,
        'extract_from_strings': True,
    }
)

# Use custom config
tool.register_project(
    name="my-project",
    root_path="/path/to/project",
    parser_config=config
)

📊 主要メトリクス

パフォーマンス

  • 分析時間: 4ファイルで1秒未満

  • クエリ時間: 依存関係クエリで10ms未満

  • 影響分析: 6つの影響を受けるテストで50ms未満

  • エクスポート時間: 9ノードで100ms未満

  • 可視化: レンダリングに1秒未満

スケーラビリティ

  • テスト済み: 84ノード、26エッジ

  • サポート: 1000ノード以上(推定)

  • メモリ: キャッシュにより効率的

  • ストレージ: JSON形式、1ノードあたり約500バイト


🤝 貢献

貢献を歓迎します!以下のガイドラインに従ってください:

  1. リポジトリをフォークする

  2. フィーチャーブランチを作成する (git checkout -b feature/amazing-feature)

  3. 変更をコミットする (git commit -m 'Add amazing feature')

  4. ブランチにプッシュする (git push origin feature/amazing-feature)

  5. プルリクエストをオープンする

開発セットアップ

# Clone your fork
git clone <your-fork-url>
cd karate-feature-graph-analyzer

# Install in development mode
pip install -e ".[dev]"

# Run tests
pytest tests/ -v

# Run linter
flake8 src/

# Format code
black src/

📝 ライセンス

このプロジェクトはMITライセンスの下でライセンスされています。詳細はLICENSEファイルを参照してください。


🙏 謝辞

  • Karate Framework - 素晴らしいBDDテストフレームワークに対して

  • NetworkX - グラフ操作に対して

  • Pyvis - インタラクティブな可視化に対して

  • Hypothesis - プロパティベースのテストに対して


📞 サポート

ドキュメント

問題

問題が発生した場合は:

  1. ドキュメントを確認する

  2. 例を確認する

  3. GitHubでIssueをオープンする


🎉 クイックリンク


Spec-Driven Developmentを使用して❤️を込めて構築されました

ステータス: ✅ 本番環境対応 バージョン: 1.0.0 最終更新日: 2026年4月30日

🚀 Happy Analyzing!

Install Server
A
license - permissive license
B
quality
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

View all related MCP servers

Related MCP Connectors

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/duyngo91/karate-graph-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server