Labsco
MCP SERVER

Test Automator

by iamsnh01

Generate unit, integration, E2E and API tests for a codebase, run them, then get an analysis of the results.

Automated Testing & QA
Summary
Generate, run, then read the report — all three, not just the first.

Test generators are common and the output usually sits unrun; having execution and report analysis as their own tools closes the loop, so the model can see what its tests actually did. The report analysis accepting XML, JSON and HTML means it also works on results from a run you did yourself.

What it is

A Python server that uses Gemini to write tests for your code and then execute them. It analyses the codebase first to understand structure and dependencies, generates pytest functions with fixtures covering positive, negative and edge cases, drives browsers through Playwright for end-to-end runs, and reads the resulting report back.

What you get
  • `generate_tests(code_path, test_type)` writes tests — `test_type` takes unit, integration, e2e, api or all
  • `run_tests(test_type, target_path)` executes them, defaulting to `tests/`
  • `analyze_test_report(report_path)` reads an XML, JSON or HTML report and returns insights and recommendations rather than a raw pass count
  • Unit generation handles both sync and async code; integration tests cover module interactions with mocking; E2E uses Playwright and captures screenshots
  • Built for large codebases: modular chunked analysis, incremental generation, and parallel runs through pytest-xdist
Requirements

Python 3.11 or newer, a Google API key for Gemini passed as `GOOGLE_API_KEY`, Git, and an MCP-capable editor. Clone the repository, create a virtualenv, `pip install -e .`, then `playwright install` to fetch the browsers — E2E tests will not run without that step. Register it with `claude mcp add test-automator <path-to-venv>/bin/test-automator -e "GOOGLE_API_KEY=..."`, or add the equivalent stdio entry to your config. On WSL, E2E runs need `DISPLAY` set.