Skip to main content
Glama
GitLab UI Test Plan Generator

GitLab UI Test Plan Generator

by Atm06

GitLab UI Test Plan Generator

An AI-powered MCP server that generates comprehensive UI test plans from GitLab merge requests using local Ollama AI models. Your code never leaves your machine.

πŸ—οΈ Project Structure

gitlab-testplan-generator/
β”œβ”€β”€ mcp-server/
β”‚   β”œβ”€β”€ src/gitlab_mcp/           # Main package
β”‚   β”‚   β”œβ”€β”€ server.py            # MCP server with ui_test_plan_from_mr tool
β”‚   β”‚   β”œβ”€β”€ analyzer.py          # GitLab MR analysis with AI
β”‚   β”‚   β”œβ”€β”€ test_planner.py      # AI-powered test plan generation
β”‚   β”‚   β”œβ”€β”€ ai_service.py        # Local Ollama AI integration
β”‚   β”‚   └── models.py            # Pydantic data models
β”‚   β”œβ”€β”€ examples/                # Usage examples
β”‚   β”‚   β”œβ”€β”€ demo_analysis.py     # Demo script
β”‚   β”‚   β”œβ”€β”€ example_usage.py     # Example usage patterns
β”‚   β”‚   └── test_ollama.py       # AI agent verification test
β”‚   β”œβ”€β”€ docs/                    # Documentation
β”‚   β”œβ”€β”€ main.py                  # Entry point
β”‚   β”œβ”€β”€ requirements.txt         # Dependencies
β”‚   └── .env                     # Environment configuration
└── venv/                        # Virtual environment

Related MCP server: GitLab MCP Server

πŸ”§ Features

πŸ€– AI-Powered Analysis

  • Uses local Ollama AI models for intelligent code analysis

  • Analyzes GitLab merge requests to identify affected UI areas

  • Generates context-aware test scenarios based on code changes

  • Privacy-first: All analysis happens locally on your machine

πŸ“‹ Comprehensive Test Plans

  • Generates UI-focused test scenarios with specific steps

  • Risk assessment for each test scenario (high/medium/low)

  • Expected results and acceptance criteria

  • Handles both positive and edge-case testing scenarios

πŸ”— Seamless Integration

  • Direct integration with Cursor IDE via MCP protocol

  • Simple @ui_test_plan_from_mr command usage

  • Works with GitLab.com and self-hosted GitLab instances

  • No external API calls - everything runs locally

πŸš€ Quick Start

1. Prerequisites

  • Python 3.8+

  • Ollama installed and running

  • GitLab personal access token

  • Cursor IDE

2. Installation

# Navigate to the project
cd gitlab-testplan-generator

# Create and activate virtual environment
python3 -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install dependencies
cd mcp-server
pip install -r requirements.txt

3. Configuration

Set up your GitLab credentials in mcp-server/.env:

GITLAB_URL=https://gitlab.cee.redhat.com  # Your GitLab instance
GITLAB_TOKEN=your-personal-access-token   # GitLab PAT with api, read_repository scopes
GITLAB_SSL_VERIFY=false                   # For internal GitLab instances

4. Install in Cursor

Add to your ~/.cursor/mcp.json:

{
  "mcpServers": {
    "gitlab-ui-test-plan-generator": {
      "command": "/path/to/gitlab-testplan-generator/venv/bin/python",
      "args": ["/path/to/gitlab-testplan-generator/mcp-server/main.py"],
      "env": {
        "GITLAB_URL": "https://gitlab.cee.redhat.com"
      }
    }
  }
}

### 5. Start Ollama

```bash
# Install and start Ollama
ollama serve

# Pull the AI model (in another terminal)
ollama pull qwen2.5-coder:1.5b
# Navigate to examples directory
cd mcp-server/examples

# Run AI agent verification test
python test_ollama.py

This test verifies:

  • βœ… Ollama server status and version

  • βœ… Required AI model availability

  • βœ… AI generation capabilities

Expected output:

=== Ollama AI Agent Status Check ===
βœ… Ollama server is running (version: 0.9.6)
βœ… Required model 'qwen2.5-coder:1.5b' is available
βœ… AI generation successful!
πŸŽ‰ All tests passed! Your AI agent is running correctly on Ollama.

Demo & Examples

# Verify AI agent is working correctly
python examples/test_ollama.py

# Run demo analysis (works offline without GitLab credentials)
python examples/demo_analysis.py

# Run with real GitLab connection
# (requires configured .env file)
python examples/demo_analysis.py

πŸ“‹ Available MCP Tool

ui_test_plan_from_mr

The main tool for generating UI test plans from GitLab merge requests.

Usage in Cursor:

@ui_test_plan_from_mr https://gitlab.cee.redhat.com/project/-/merge_requests/123

What it does:

  1. πŸ” Analyzes the merge request and extracts code changes

  2. πŸ€– Uses local AI to understand the impact of changes

  3. 🎯 Identifies affected UI areas and components

  4. πŸ“‹ Generates comprehensive test scenarios with specific steps

  5. ⚠️ Provides risk assessment for each scenario

πŸ’‘ Usage Examples

In Cursor:

@ui_test_plan_from_mr https://gitlab.cee.redhat.com/<project_name>/merge_requests/12345

@ui_test_plan_from_mr https://gitlab.cee.redhat.com/project/-/merge_requests/123/diffs

Example Output:

The tool generates:

  • MR Title: [JIRA-ID]: MR title description

  • Affected Pages: Affected pages and components

  • Test Scenarios: 2-5 AI-generated scenarios

  • Risk Levels: High/Medium/Low for each scenario

  • Detailed Steps: Specific actions and expected results

  • AI Insights: Summary of changes and user impact

πŸ”§ Architecture

Core Components

  • CodeAnalyzer: Analyzes GitLab merge requests and calculates complexity/risk scores

  • UITestPlanGenerator: Creates comprehensive test plans based on change analysis

  • MCP Server: Exposes functionality through the Model Context Protocol

  • Models: Pydantic data models for type safety and validation

Component Analysis

The system automatically identifies components based on file patterns:

  • Authentication: /auth/, /login/, /user/ files

  • Database: .sql, migration files, /models/, /db/ files

  • API: /api/, /endpoints/, /routes/ files

  • Frontend: .js, .ts, .vue, .html, .css files

  • Backend: .py, .java, .cpp, .go files

  • Configuration: /config/, .env, .yaml, .json files

  • Security: /security/, /ssl/ files

Risk Assessment

The server automatically assesses risk levels:

  • High Risk: Security files, database migrations, configuration files, complex changes (>100 lines)

  • Medium Risk: API files, service files, moderate complexity (50-100 lines)

  • Low Risk: Documentation, simple changes (<50 lines)

πŸ“– Documentation

  • Setup Guide: Detailed setup instructions

  • Examples: Working code examples and verification scripts

🀝 Contributing

  1. Fork the repository

  2. Create a feature branch: git checkout -b feature-name

  3. Make your changes and test manually

  4. Verify AI agent functionality: python examples/test_ollama.py

  5. Test with real GitLab merge requests

  6. Submit a pull request

Development Setup

# Install dependencies
pip install -r requirements.txt

# Verify setup
python examples/demo_analysis.py

πŸ“ License

MIT License - see LICENSE file for details.

πŸ†˜ Troubleshooting

Common Issues

  1. Import Errors: Make sure you've installed the package with pip install -e .

  2. GitLab Connection: Verify your token has correct permissions and hasn't expired

  3. MCP Installation: Ensure Cursor has MCP support enabled

Debug Mode

# Run with debug logging
export PYTHONPATH=src
python -m gitlab_mcp.server --log-level debug

Ready to start? Check out the Setup Guide for detailed instructions!

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables AI assistants to review GitLab merge requests by fetching changes, analyzing diffs, adding comments, and managing approvals through the GitLab API. Supports complete merge request analysis, file-specific reviews, and version comparisons.
      12
      4
      MIT
    • F
      license
      A
      quality
      C
      maintenance
      Connects AI assistants to GitLab to interact with merge requests, reviews, discussions, pipelines, and test results through natural language queries. Supports viewing MR details, responding to comments, checking test summaries, and analyzing job logs.
      12
      2
      -
    • F
      license
      Not graded
      quality
      Not graded
      maintenance
      Connects AI assistants to GitLab projects, enabling natural language queries for merge requests, code reviews, test results, pipelines, and discussions. Supports viewing MR details, responding to comments, and analyzing CI/CD job logs.
      -