azure-devops-mcp
by RyanCardin15
Verified
- src
- Services
import { AzureDevOpsConfig } from "../Interfaces/AzureDevOps";
import { AzureDevOpsService } from "./AzureDevOpsService";
import {
RunAutomatedTestsParams,
GetTestAutomationStatusParams,
ConfigureTestAgentsParams,
CreateTestDataGeneratorParams,
ManageTestEnvironmentsParams,
GetTestFlakinessParams,
GetTestGapAnalysisParams,
RunTestImpactAnalysisParams,
GetTestHealthDashboardParams,
RunTestOptimizationParams,
CreateExploratorySessionsParams,
RecordExploratoryTestResultsParams,
ConvertFindingsToWorkItemsParams,
GetExploratoryTestStatisticsParams
} from "../Interfaces/TestingCapabilities";
export class TestingCapabilitiesService extends AzureDevOpsService {
constructor(config: AzureDevOpsConfig) {
super(config);
}
async runAutomatedTests(params: RunAutomatedTestsParams) {
// This would contain actual implementation
// For now, we're returning a mock response
return {
success: true,
testRunId: 12345,
message: "Automated tests started successfully",
};
}
async getTestAutomationStatus(params: GetTestAutomationStatusParams) {
return {
testRunId: params.testRunId,
status: "in_progress",
completedTests: 10,
totalTests: 25,
passedTests: 8,
failedTests: 2,
};
}
async configureTestAgents(params: ConfigureTestAgentsParams) {
return {
agentName: params.agentName,
enabled: params.enabled ?? true,
capabilities: params.capabilities,
status: "configured",
};
}
async createTestDataGenerator(params: CreateTestDataGeneratorParams) {
return {
generatorId: "gen-123",
name: params.name,
recordCount: params.recordCount || 100,
status: "created",
};
}
async manageTestEnvironments(params: ManageTestEnvironmentsParams) {
return {
environmentName: params.environmentName,
action: params.action,
status: "success",
properties: params.properties,
};
}
async getTestFlakiness(params: GetTestFlakinessParams) {
return {
flakyTests: [
{ testId: 123, name: "LoginTest", flakinessScore: 0.35, failureCount: 7, totalRuns: 20 },
{ testId: 456, name: "CheckoutTest", flakinessScore: 0.15, failureCount: 3, totalRuns: 20 }
],
timeRange: params.timeRange || "30d",
};
}
async getTestGapAnalysis(params: GetTestGapAnalysisParams) {
return {
coverage: 78.5,
untested: [
{ area: "Authentication", coverage: 65.8, recommendation: "Add tests for password reset" },
{ area: "Checkout", coverage: 82.3, recommendation: "Add tests for promo code validation" }
],
areaPath: params.areaPath,
};
}
async runTestImpactAnalysis(params: RunTestImpactAnalysisParams) {
return {
buildId: params.buildId,
impactedTests: [
{ testId: 123, name: "UserProfileTest", impact: "high" },
{ testId: 456, name: "PaymentGatewayTest", impact: "medium" }
],
totalTests: 150,
impactedTestCount: 12,
};
}
async getTestHealthDashboard(params: GetTestHealthDashboardParams) {
return {
overallHealth: 82.4,
passRate: 91.5,
flakiness: 7.2,
coverage: 78.5,
executionTime: "3h 24m",
trends: params.includeTrends ? {
passRate: [90.2, 89.8, 91.5],
coverage: [76.2, 77.8, 78.5],
executionTime: ["3h 45m", "3h 30m", "3h 24m"]
} : undefined,
};
}
async runTestOptimization(params: RunTestOptimizationParams) {
return {
testPlanId: params.testPlanId,
optimizationGoal: params.optimizationGoal,
results: {
originalDuration: "4h 15m",
optimizedDuration: "2h 45m",
timeReduction: 35.3,
prioritizedTests: 45,
deprioritizedTests: 15,
},
};
}
async createExploratorySessions(params: CreateExploratorySessionsParams) {
return {
sessionId: 789,
title: params.title,
description: params.description,
status: "created",
createdDate: new Date().toISOString(),
};
}
async recordExploratoryTestResults(params: RecordExploratoryTestResultsParams) {
return {
sessionId: params.sessionId,
recordedFindings: params.findings.length,
status: "recorded",
summary: {
issues: params.findings.length,
attachments: params.attachments?.length || 0,
},
};
}
async convertFindingsToWorkItems(params: ConvertFindingsToWorkItemsParams) {
return {
sessionId: params.sessionId,
workItemIds: [1001, 1002, 1003],
status: "converted",
workItemType: params.workItemType || "Bug",
};
}
async getExploratoryTestStatistics(params: GetExploratoryTestStatisticsParams) {
return {
sessionCount: 24,
totalFindings: 87,
convertedToWorkItems: 65,
timeSpent: "48h 30m",
findingsPerSession: 3.6,
timeRange: params.timeRange || "90d",
};
}
}