Package Exports
- @betabridge/ai-testing-agent
- @betabridge/ai-testing-agent/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@betabridge/ai-testing-agent) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
🤖 AI Testing Agent
AI-powered testing agent for frontend, backend, Logic Apps, and Function Apps using Model Context Protocol (MCP). Automate your testing workflows with intelligent test generation and execution.
✨ Features
- 🎯 Multi-Platform Testing: Frontend UI, Backend APIs, Azure Logic Apps, and Function Apps
- 🤖 AI-Powered: Generate test cases from natural language descriptions
- 🔧 MCP Integration: Built on Model Context Protocol for extensibility
- ⚡ Parallel Execution: Run multiple tests simultaneously
- 📊 Rich Reporting: Detailed test results with screenshots and logs
- 🛠️ CLI & Programmatic: Use via command line or import in your code
- 🎨 TypeScript Support: Full type definitions included
🚀 Quick Start
Installation
# Install globally for CLI usage
npm install -g @ai-testing/agent
# Or install locally in your project
npm install @ai-testing/agentCLI Usage
# Create a test case template
ai-testing-agent create "Login Test" --type frontend --output login-test.json
# Run test cases
ai-testing-agent run test-cases.json --parallel --headless
# Validate test cases
ai-testing-agent validate test-cases.json
# Start MCP server
ai-testing-agent server --port 8080Programmatic Usage
import { TestOrchestrator, TestCase } from '@ai-testing/agent';
const orchestrator = new TestOrchestrator();
const testCase: TestCase = {
id: 'login-test',
name: 'User Login Test',
description: 'Test user login functionality',
type: 'frontend',
targetUrl: 'https://example.com',
steps: [
{ action: 'navigate', url: 'https://example.com/login' },
{ action: 'type', selector: '#email', value: 'user@example.com' },
{ action: 'type', selector: '#password', value: 'password123' },
{ action: 'click', selector: '#login-button' }
],
expectedResults: [
'User should be redirected to dashboard',
'Welcome message should be displayed'
]
};
// Run the test
const result = await orchestrator.runTest(testCase);
console.log(`Test ${result.status}: ${result.duration}ms`);📋 Test Types
Frontend Testing
Automated browser testing using Playwright:
const frontendTest: TestCase = {
type: 'frontend',
targetUrl: 'https://myapp.com',
steps: [
{ action: 'navigate', url: 'https://myapp.com' },
{ action: 'click', selector: '.login-button' },
{ action: 'type', selector: '#email', value: 'test@example.com' },
{ action: 'assert', selector: '.success-message', expected: 'Login successful' }
]
};Backend API Testing
REST API testing with Axios:
const backendTest: TestCase = {
type: 'backend',
targetUrl: 'https://api.example.com',
steps: [
{ action: 'api-call', endpoint: '/auth/login', method: 'POST', payload: { email: 'test@example.com', password: 'password' } },
{ action: 'assert', expected: { status: 200, data: { token: 'string' } } }
]
};Azure Logic App Testing
Test Azure Logic App workflows:
const logicAppTest: TestCase = {
type: 'logic-app',
steps: [
{ action: 'trigger', endpoint: 'https://your-logic-app.azurewebsites.net/api/trigger' },
{ action: 'assert', expected: { status: 'Succeeded' } }
]
};Azure Function App Testing
Test Azure Functions:
const functionAppTest: TestCase = {
type: 'function-app',
steps: [
{ action: 'trigger', endpoint: 'https://your-function-app.azurewebsites.net/api/process' },
{ action: 'assert', expected: { status: 200 } }
]
};🔧 Configuration
Test Configuration
import { TestRunner } from '@ai-testing/agent';
const runner = new TestRunner({
headless: true, // Run browser in headless mode
timeout: 30000, // Test timeout in milliseconds
parallel: true, // Run tests in parallel
maxConcurrency: 5, // Maximum concurrent tests
screenshotOnFailure: true, // Take screenshots on failure
outputDir: './test-results' // Output directory for results
});Azure Configuration
import { LogicAppTestingEngine, FunctionAppTestingEngine } from '@ai-testing/agent';
// Configure Azure credentials
const logicAppEngine = new LogicAppTestingEngine();
logicAppEngine.setAzureCredentials(
'your-subscription-id',
'your-resource-group',
'your-access-token'
);
const functionAppEngine = new FunctionAppTestingEngine();
functionAppEngine.setFunctionAppCredentials(
'https://your-function-app.azurewebsites.net',
'your-function-key'
);📊 Test Results
Test results include comprehensive information:
interface TestResult {
testId: string;
status: 'running' | 'passed' | 'failed' | 'error';
steps: StepResult[];
screenshot?: string | Buffer;
logs: string[];
duration: number;
error?: string;
startTime?: number;
endTime?: number;
}🛠️ Development
Building the Package
# Build the package
npm run build:package
# Test the build
npm run pack
# Publish to npm
npm run publish:publicProject Structure
src/
├── index.ts # Main exports
├── cli/
│ └── index.ts # CLI implementation
├── mcp/
│ ├── client.ts # MCP client
│ └── server.ts # MCP server
├── testing/
│ ├── test-orchestrator.ts
│ ├── frontend-engine.ts
│ ├── backend-engine.ts
│ ├── logic-app-engine.ts
│ └── function-app-engine.ts
├── runner/
│ └── test-runner.ts # Test runner
├── types.ts # TypeScript definitions
└── utils/
└── test-helpers.ts # Utility functions🤝 Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📝 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- Playwright for browser automation
- Model Context Protocol for extensibility
- Commander.js for CLI interface
- Axios for HTTP requests
📞 Support
Made with ❤️ by the AI Testing Agent Team