UniAuto MCP Server offers powerful AI-driven test generation capabilities that can automatically create test cases in various frameworks and styles by analyzing applications.
The server exposes several REST endpoints for test generation:
Generate test cases for a specific URL using a chosen framework and style.
Endpoint: POST /api/generate-tests
Parameters:
url
(required): URL of the application to analyzeframework
(optional): Test framework to use (e.g., playwright, cypress, jest)style
(optional): Test style (e.g., bdd, tdd)format
(optional): Output format (e.g., javascript, typescript, python)prompt
(optional): User prompt describing test requirementsoutputPath
(optional): Path to save generated testsadditionalContext
(optional): Additional context for test generationGenerate a complete test suite with various test types (unit, integration, e2e, etc.) for an application.
Endpoint: POST /api/generate-full-suite
Parameters:
url
(required): URL of the application to analyzeframework
(optional): Test framework to useformat
(optional): Output formatoutputDir
(optional): Directory to save generated testsadditionalContext
(optional): Additional context for test generationCreate a complete test project structure with configuration files for a specific framework.
Endpoint: POST /api/scaffold-project
Parameters:
framework
(required): Test framework to useoutputDir
(required): Directory to create the projectGet a list of supported test frameworks, styles, and formats.
Endpoint: GET /api/test-frameworks
Test generation capabilities are fully integrated with MCP, allowing AI assistants to generate tests directly.
The following MCP actions are supported:
generate_tests
: Generate test casesgenerate_test_suite
: Generate a complete test suitescaffold_project
: Scaffold a test projectlist_frameworks
: List available frameworks, styles, and formats{
"action": "generate_tests",
"parameters": {
"url": "https://demo.playwright.dev/todomvc",
"framework": "playwright",
"style": "bdd",
"format": "javascript",
"prompt": "Generate tests for a TODO application"
},
"executionId": "test-execution-id-123"
}
const axios = require('axios');
// Generate tests
const response = await axios.post('http://localhost:3000/api/generate-tests', {
url: 'https://demo.playwright.dev/todomvc',
framework: 'playwright',
style: 'bdd',
format: 'javascript',
prompt: 'Generate tests for a TODO application'
});
console.log(response.data.testCode);
See the examples/test-generation-demo.js
script for a complete demonstration.