snow-flow 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{.claude/mcp-config.json → .mcp.json} +13 -12
- package/.releaserc.json +47 -0
- package/README.md +6 -0
- package/package.json +1 -1
- package/.claude/claude-settings.json +0 -15
- package/.claude/commands/analysis/README.md +0 -9
- package/.claude/commands/automation/README.md +0 -9
- package/.claude/commands/github/README.md +0 -11
- package/.claude/commands/helpers/standard-checkpoint-hooks.sh +0 -179
- package/.claude/commands/hooks/README.md +0 -11
- package/.claude/commands/monitoring/README.md +0 -9
- package/.claude/commands/optimization/README.md +0 -9
- package/.claude/commands/training/README.md +0 -9
- package/.claude/commands/workflows/README.md +0 -9
- package/.claude/config.json +0 -36
- package/.claude/helpers/github-setup.sh +0 -28
- package/.claude/helpers/quick-start.sh +0 -19
- package/.claude/helpers/setup-mcp.sh +0 -18
- package/.claude/settings.json +0 -114
- package/.claude/settings.local.json +0 -33
- package/.claude-flow/metrics/agent-metrics.json +0 -1
- package/.claude-flow/metrics/performance.json +0 -9
- package/.claude-flow/metrics/system-metrics.json +0 -15986
- package/.claude-flow/metrics/task-metrics.json +0 -10
- package/.roo/README.md +0 -402
- package/.roo/mcp-list.txt +0 -257
- package/.roo/mcp.json +0 -32
- package/.roo/workflows/basic-tdd.json +0 -32
- package/.roomodes +0 -201
- package/CLAUDE.md +0 -393
- package/bin/snow-flow.js +0 -3
- package/dist/cli.js.bak +0 -2052
- package/dist/config/snow-flow-config.d.ts +0 -1492
- package/dist/config/snow-flow-config.js +0 -938
- package/scripts/create-env.js +0 -91
- package/scripts/postinstall.js +0 -30
- package/scripts/register-mcp-servers.js +0 -210
- package/scripts/reset-mcp-servers.js +0 -246
- package/scripts/setup-mcp.js +0 -106
- package/scripts/update-version.js +0 -31
- package/src/agents/README.md +0 -192
- package/src/agents/base-agent.ts +0 -251
- package/src/agents/coordinator.ts +0 -971
- package/src/agents/index.ts +0 -18
- package/src/agents/queen-403-handler.ts +0 -230
- package/src/agents/queen-agent.ts +0 -1399
- package/src/agents/script-writer-agent.ts +0 -769
- package/src/agents/security-agent.ts +0 -726
- package/src/agents/widget-creator-agent.ts +0 -568
- package/src/api/error-handling.ts +0 -1758
- package/src/api/natural-language-mapper.ts +0 -630
- package/src/api/performance-optimizer.ts +0 -891
- package/src/api/transaction-manager.ts +0 -754
- package/src/cli/deploy-artifact.ts +0 -304
- package/src/cli/snow-flow-cli-integration.ts +0 -434
- package/src/cli.ts +0 -4455
- package/src/cli.ts.bak +0 -5616
- package/src/compliance/advanced-compliance-system.ts +0 -1268
- package/src/compliance/index.ts +0 -19
- package/src/config/snow-flow-config.ts +0 -1019
- package/src/documentation/index.ts +0 -16
- package/src/documentation/self-documenting-system.ts +0 -1421
- package/src/dynamic-version.ts +0 -44
- package/src/healing/index.ts +0 -20
- package/src/healing/self-healing-system.ts +0 -1435
- package/src/health/README.md +0 -161
- package/src/health/system-health.ts +0 -995
- package/src/index.ts +0 -60
- package/src/intelligence/acl-analyzer.ts +0 -377
- package/src/intelligence/auto-resolution-engine.ts +0 -643
- package/src/intelligence/gap-analysis-engine.ts +0 -488
- package/src/intelligence/manual-instructions-generator.ts +0 -744
- package/src/intelligence/mcp-coverage-analyzer.ts +0 -708
- package/src/intelligence/multi-pass-requirements-analyzer.ts +0 -603
- package/src/intelligence/performance-recommendations-engine.ts +0 -1223
- package/src/intelligence/requirements-analyzer.ts +0 -1148
- package/src/intelligence/task-analyzer.ts +0 -628
- package/src/managers/scope-manager.ts +0 -555
- package/src/mcp/advanced/servicenow-advanced-features-mcp.ts +0 -16110
- package/src/mcp/base-mcp-server.ts +0 -660
- package/src/mcp/http-transport-wrapper.ts +0 -426
- package/src/mcp/service-discovery-client.ts +0 -312
- package/src/mcp/servicenow-automation-mcp-refactored.ts +0 -678
- package/src/mcp/servicenow-automation-mcp.ts +0 -838
- package/src/mcp/servicenow-deployment-mcp-refactored.ts +0 -1292
- package/src/mcp/servicenow-deployment-mcp.ts +0 -7244
- package/src/mcp/servicenow-graph-memory-mcp-refactored.ts +0 -721
- package/src/mcp/servicenow-graph-memory-mcp.ts +0 -832
- package/src/mcp/servicenow-integration-mcp-refactored.ts +0 -655
- package/src/mcp/servicenow-integration-mcp.ts +0 -819
- package/src/mcp/servicenow-intelligent-mcp-refactored.ts +0 -977
- package/src/mcp/servicenow-intelligent-mcp.ts +0 -4638
- package/src/mcp/servicenow-mcp-server.ts +0 -728
- package/src/mcp/servicenow-memory-mcp.ts +0 -474
- package/src/mcp/servicenow-operations-mcp-refactored.ts +0 -1995
- package/src/mcp/servicenow-operations-mcp.ts +0 -3384
- package/src/mcp/servicenow-platform-development-mcp-refactored.ts +0 -611
- package/src/mcp/servicenow-platform-development-mcp.ts +0 -970
- package/src/mcp/servicenow-progressive-indexer.ts +0 -370
- package/src/mcp/servicenow-reporting-analytics-mcp-refactored.ts +0 -695
- package/src/mcp/servicenow-reporting-analytics-mcp.ts +0 -1123
- package/src/mcp/servicenow-security-compliance-mcp-refactored.ts +0 -642
- package/src/mcp/servicenow-security-compliance-mcp.ts +0 -1157
- package/src/mcp/servicenow-update-set-mcp-refactored.ts +0 -751
- package/src/mcp/servicenow-update-set-mcp.ts +0 -811
- package/src/mcp/shared/agent-context-provider.ts +0 -365
- package/src/mcp/shared/base-mcp-server.ts +0 -2463
- package/src/mcp/shared/mcp-memory-manager.ts +0 -540
- package/src/mcp/shared/mcp-resource-manager.ts +0 -367
- package/src/mcp/snow-flow-mcp.ts +0 -911
- package/src/mcp/start-all-mcp-servers.ts +0 -102
- package/src/mcp/start-servicenow-mcp.ts +0 -67
- package/src/monitoring/enhanced-monitoring-system.ts +0 -1345
- package/src/monitoring/performance-tracker.ts +0 -777
- package/src/optimization/cost-optimization-engine.ts +0 -1125
- package/src/optimization/index.ts +0 -10
- package/src/queen/README.md +0 -403
- package/src/queen/agent-factory.ts +0 -574
- package/src/queen/index.ts +0 -94
- package/src/queen/mcp-execution-bridge.ts +0 -681
- package/src/queen/neural-learning.ts +0 -319
- package/src/queen/parallel-agent-engine.ts +0 -848
- package/src/queen/queen-memory-system.ts +0 -490
- package/src/queen/queen-memory.ts +0 -456
- package/src/queen/servicenow-queen.ts +0 -1029
- package/src/queen/types.ts +0 -87
- package/src/rollback/smart-rollback-system.ts +0 -866
- package/src/schemas/deployment.schema.json +0 -58
- package/src/schemas/flow.schema.json +0 -79
- package/src/schemas/widget.schema.json +0 -72
- package/src/snow-flow-system.ts +0 -541
- package/src/sparc/sparc-help.ts +0 -49
- package/src/sparc/team-sparc.ts +0 -88
- package/src/strategies/global-scope-strategy.ts +0 -736
- package/src/templates/base/application.template.json +0 -45
- package/src/templates/base/business_rule.template.json +0 -33
- package/src/templates/base/script_include.template.json +0 -18
- package/src/templates/base/table.template.json +0 -64
- package/src/templates/base/widget.template.json +0 -25
- package/src/templates/patterns/composite.incident-management.template.json +0 -140
- package/src/templates/patterns/widget.dashboard.template.json +0 -238
- package/src/templates/patterns/widget.datatable.template.json +0 -292
- package/src/testing/integration-test-suite.ts +0 -1276
- package/src/types/index.ts +0 -183
- package/src/types/neo4j-driver.d.ts +0 -23
- package/src/types/servicenow.types.ts +0 -307
- package/src/types/snow-flow.types.ts +0 -186
- package/src/types/todo.types.ts +0 -70
- package/src/utils/action-type-cache.ts +0 -286
- package/src/utils/agent-detector.ts +0 -573
- package/src/utils/artifact-tracker.ts +0 -379
- package/src/utils/dependency-detector.ts +0 -233
- package/src/utils/deployment-metadata-handler.ts +0 -518
- package/src/utils/error-recovery.ts +0 -680
- package/src/utils/logger.ts +0 -60
- package/src/utils/mcp-auth-middleware.ts +0 -262
- package/src/utils/mcp-config-manager.ts +0 -270
- package/src/utils/mcp-server-manager.ts +0 -446
- package/src/utils/mcp-tool-registry.ts +0 -298
- package/src/utils/migrate-snow-flow.ts +0 -98
- package/src/utils/oauth-html-templates.ts +0 -188
- package/src/utils/scope-utils.ts +0 -443
- package/src/utils/servicenow-client.ts +0 -3321
- package/src/utils/servicenow-id-generator.ts +0 -181
- package/src/utils/snow-memory-manager.ts +0 -605
- package/src/utils/snow-oauth.ts +0 -797
- package/src/utils/template-engine.ts +0 -463
- package/src/utils/theme-manager.ts +0 -295
- package/src/utils/unified-auth-store.ts +0 -222
- package/src/utils/update-set-importer.ts +0 -422
- package/src/utils/update-set-xml-packager.ts +0 -371
- package/src/utils/widget-template-generator.ts +0 -1744
- package/src/version.ts +0 -1950
|
@@ -1,1276 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 🚀 Comprehensive Integration Test Suite
|
|
3
|
-
*
|
|
4
|
-
* Complete integration testing framework that validates end-to-end
|
|
5
|
-
* functionality across all snow-flow components, ensures system
|
|
6
|
-
* reliability, and provides comprehensive test coverage.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { Logger } from '../utils/logger.js';
|
|
10
|
-
import { ServiceNowClient } from '../utils/servicenow-client.js';
|
|
11
|
-
import { MemorySystem } from '../memory/memory-system.js';
|
|
12
|
-
// Flow-related imports removed in v1.4.0
|
|
13
|
-
// import { FlowTemplateSystem } from '../templates/flow-template-system.js';
|
|
14
|
-
// import { FlowUpdateOrchestrator } from '../orchestration/flow-update-orchestrator.js';
|
|
15
|
-
// import { FlowTestingAutomation } from './flow-testing-automation.js';
|
|
16
|
-
// import { SmartRollbackSystem } from '../rollback/smart-rollback-system.js';
|
|
17
|
-
// import { FlowPerformanceOptimizer } from '../optimization/flow-performance-optimizer.js';
|
|
18
|
-
|
|
19
|
-
export interface IntegrationTestSuite {
|
|
20
|
-
id: string;
|
|
21
|
-
name: string;
|
|
22
|
-
description: string;
|
|
23
|
-
version: string;
|
|
24
|
-
testCategories: TestCategory[];
|
|
25
|
-
configuration: TestConfiguration;
|
|
26
|
-
metadata: {
|
|
27
|
-
createdAt: string;
|
|
28
|
-
author: string;
|
|
29
|
-
environment: string;
|
|
30
|
-
totalTests: number;
|
|
31
|
-
estimatedDuration: number;
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface TestCategory {
|
|
36
|
-
name: string;
|
|
37
|
-
description: string;
|
|
38
|
-
tests: IntegrationTest[];
|
|
39
|
-
dependencies: string[];
|
|
40
|
-
priority: 'critical' | 'high' | 'medium' | 'low';
|
|
41
|
-
parallelExecution: boolean;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export interface IntegrationTest {
|
|
45
|
-
id: string;
|
|
46
|
-
name: string;
|
|
47
|
-
description: string;
|
|
48
|
-
type: 'component' | 'system' | 'api' | 'workflow' | 'performance' | 'security';
|
|
49
|
-
steps: TestStep[];
|
|
50
|
-
setup: TestSetup;
|
|
51
|
-
teardown: TestTeardown;
|
|
52
|
-
assertions: TestAssertion[];
|
|
53
|
-
timeout: number;
|
|
54
|
-
retryCount: number;
|
|
55
|
-
tags: string[];
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export interface TestStep {
|
|
59
|
-
order: number;
|
|
60
|
-
name: string;
|
|
61
|
-
action: string;
|
|
62
|
-
parameters: Record<string, any>;
|
|
63
|
-
expectedResult?: any;
|
|
64
|
-
validation?: string;
|
|
65
|
-
timeout?: number;
|
|
66
|
-
optional?: boolean;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface TestSetup {
|
|
70
|
-
prerequisites: string[];
|
|
71
|
-
dataPreparation: DataPreparation[];
|
|
72
|
-
systemConfiguration: SystemConfiguration[];
|
|
73
|
-
mockServices: MockService[];
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export interface TestTeardown {
|
|
77
|
-
cleanupActions: CleanupAction[];
|
|
78
|
-
dataRestoration: DataRestoration[];
|
|
79
|
-
systemReset: SystemReset[];
|
|
80
|
-
verificationChecks: VerificationCheck[];
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export interface TestAssertion {
|
|
84
|
-
type: 'equals' | 'contains' | 'exists' | 'greater_than' | 'less_than' | 'matches_pattern';
|
|
85
|
-
target: string;
|
|
86
|
-
expected: any;
|
|
87
|
-
message: string;
|
|
88
|
-
critical: boolean;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export interface DataPreparation {
|
|
92
|
-
action: 'create' | 'update' | 'delete' | 'backup';
|
|
93
|
-
table: string;
|
|
94
|
-
data: Record<string, any>;
|
|
95
|
-
identifier?: string;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export interface SystemConfiguration {
|
|
99
|
-
component: string;
|
|
100
|
-
parameter: string;
|
|
101
|
-
value: any;
|
|
102
|
-
backup?: boolean;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export interface MockService {
|
|
106
|
-
name: string;
|
|
107
|
-
type: 'http' | 'database' | 'external_api';
|
|
108
|
-
configuration: Record<string, any>;
|
|
109
|
-
responses: MockResponse[];
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export interface MockResponse {
|
|
113
|
-
request: {
|
|
114
|
-
method?: string;
|
|
115
|
-
path?: string;
|
|
116
|
-
headers?: Record<string, string>;
|
|
117
|
-
body?: any;
|
|
118
|
-
};
|
|
119
|
-
response: {
|
|
120
|
-
status: number;
|
|
121
|
-
headers?: Record<string, string>;
|
|
122
|
-
body: any;
|
|
123
|
-
delay?: number;
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
export interface CleanupAction {
|
|
128
|
-
action: string;
|
|
129
|
-
parameters: Record<string, any>;
|
|
130
|
-
order: number;
|
|
131
|
-
critical: boolean;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export interface DataRestoration {
|
|
135
|
-
table: string;
|
|
136
|
-
backupId: string;
|
|
137
|
-
verify: boolean;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
export interface SystemReset {
|
|
141
|
-
component: string;
|
|
142
|
-
resetType: 'soft' | 'hard' | 'factory';
|
|
143
|
-
verification: string;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export interface VerificationCheck {
|
|
147
|
-
name: string;
|
|
148
|
-
check: string;
|
|
149
|
-
expectedResult: any;
|
|
150
|
-
critical: boolean;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
export interface TestConfiguration {
|
|
154
|
-
environment: 'development' | 'testing' | 'staging' | 'production';
|
|
155
|
-
parallelism: {
|
|
156
|
-
enabled: boolean;
|
|
157
|
-
maxConcurrency: number;
|
|
158
|
-
categoryLevel: boolean;
|
|
159
|
-
testLevel: boolean;
|
|
160
|
-
};
|
|
161
|
-
reporting: {
|
|
162
|
-
format: 'console' | 'json' | 'html' | 'junit';
|
|
163
|
-
outputPath: string;
|
|
164
|
-
includeDetails: boolean;
|
|
165
|
-
screenshotOnFailure: boolean;
|
|
166
|
-
};
|
|
167
|
-
retry: {
|
|
168
|
-
enabled: boolean;
|
|
169
|
-
maxAttempts: number;
|
|
170
|
-
backoffStrategy: 'fixed' | 'exponential' | 'linear';
|
|
171
|
-
backoffDelay: number;
|
|
172
|
-
};
|
|
173
|
-
timeouts: {
|
|
174
|
-
default: number;
|
|
175
|
-
setup: number;
|
|
176
|
-
teardown: number;
|
|
177
|
-
assertion: number;
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
export interface TestExecution {
|
|
182
|
-
id: string;
|
|
183
|
-
suiteId: string;
|
|
184
|
-
startTime: string;
|
|
185
|
-
endTime?: string;
|
|
186
|
-
status: 'running' | 'completed' | 'failed' | 'cancelled';
|
|
187
|
-
progress: number;
|
|
188
|
-
results: CategoryResult[];
|
|
189
|
-
summary: ExecutionSummary;
|
|
190
|
-
issues: TestIssue[];
|
|
191
|
-
artifacts: TestArtifact[];
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
export interface CategoryResult {
|
|
195
|
-
categoryName: string;
|
|
196
|
-
status: 'running' | 'completed' | 'failed' | 'skipped';
|
|
197
|
-
startTime: string;
|
|
198
|
-
endTime?: string;
|
|
199
|
-
testResults: TestResult[];
|
|
200
|
-
summary: {
|
|
201
|
-
total: number;
|
|
202
|
-
passed: number;
|
|
203
|
-
failed: number;
|
|
204
|
-
skipped: number;
|
|
205
|
-
errors: number;
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
export interface TestResult {
|
|
210
|
-
testId: string;
|
|
211
|
-
name: string;
|
|
212
|
-
status: 'passed' | 'failed' | 'skipped' | 'error';
|
|
213
|
-
startTime: string;
|
|
214
|
-
endTime: string;
|
|
215
|
-
duration: number;
|
|
216
|
-
stepResults: StepResult[];
|
|
217
|
-
assertionResults: AssertionResult[];
|
|
218
|
-
error?: string;
|
|
219
|
-
logs: string[];
|
|
220
|
-
artifacts: TestArtifact[];
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
export interface StepResult {
|
|
224
|
-
stepOrder: number;
|
|
225
|
-
name: string;
|
|
226
|
-
status: 'passed' | 'failed' | 'skipped' | 'error';
|
|
227
|
-
duration: number;
|
|
228
|
-
result?: any;
|
|
229
|
-
error?: string;
|
|
230
|
-
validationPassed?: boolean;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
export interface AssertionResult {
|
|
234
|
-
type: string;
|
|
235
|
-
target: string;
|
|
236
|
-
expected: any;
|
|
237
|
-
actual: any;
|
|
238
|
-
passed: boolean;
|
|
239
|
-
message: string;
|
|
240
|
-
critical: boolean;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
export interface ExecutionSummary {
|
|
244
|
-
totalTests: number;
|
|
245
|
-
totalCategories: number;
|
|
246
|
-
passed: number;
|
|
247
|
-
failed: number;
|
|
248
|
-
skipped: number;
|
|
249
|
-
errors: number;
|
|
250
|
-
successRate: number;
|
|
251
|
-
totalDuration: number;
|
|
252
|
-
averageTestDuration: number;
|
|
253
|
-
criticalFailures: number;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
export interface TestIssue {
|
|
257
|
-
severity: 'low' | 'medium' | 'high' | 'critical';
|
|
258
|
-
category: 'setup' | 'execution' | 'assertion' | 'teardown' | 'system';
|
|
259
|
-
description: string;
|
|
260
|
-
testId?: string;
|
|
261
|
-
stepOrder?: number;
|
|
262
|
-
recommendation: string;
|
|
263
|
-
autoResolvable: boolean;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
export interface TestArtifact {
|
|
267
|
-
type: 'log' | 'screenshot' | 'data_dump' | 'performance_report' | 'error_trace';
|
|
268
|
-
name: string;
|
|
269
|
-
path: string;
|
|
270
|
-
size: number;
|
|
271
|
-
timestamp: string;
|
|
272
|
-
metadata?: Record<string, any>;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
export class IntegrationTestSuite {
|
|
276
|
-
private logger: Logger;
|
|
277
|
-
private client: ServiceNowClient;
|
|
278
|
-
private memory: MemorySystem;
|
|
279
|
-
// Flow-related systems removed in v1.4.0
|
|
280
|
-
// private templateSystem: FlowTemplateSystem;
|
|
281
|
-
// private updateOrchestrator: FlowUpdateOrchestrator;
|
|
282
|
-
// private testingAutomation: FlowTestingAutomation;
|
|
283
|
-
// private rollbackSystem: SmartRollbackSystem;
|
|
284
|
-
// private performanceOptimizer: FlowPerformanceOptimizer;
|
|
285
|
-
|
|
286
|
-
private testSuites: Map<string, IntegrationTestSuite> = new Map();
|
|
287
|
-
private executions: Map<string, TestExecution> = new Map();
|
|
288
|
-
private mockServices: Map<string, MockService> = new Map();
|
|
289
|
-
|
|
290
|
-
constructor() {
|
|
291
|
-
this.logger = new Logger('IntegrationTestSuite');
|
|
292
|
-
this.client = new ServiceNowClient();
|
|
293
|
-
this.memory = new MemorySystem({ dbPath: ':memory:' });
|
|
294
|
-
// Flow-related system initialization removed in v1.4.0
|
|
295
|
-
// this.templateSystem = new FlowTemplateSystem(this.client);
|
|
296
|
-
// this.updateOrchestrator = new FlowUpdateOrchestrator(this.client, this.memory);
|
|
297
|
-
// this.testingAutomation = new FlowTestingAutomation(this.client, this.memory);
|
|
298
|
-
// this.rollbackSystem = new SmartRollbackSystem(this.client, this.memory);
|
|
299
|
-
// this.performanceOptimizer = new FlowPerformanceOptimizer(this.client, this.memory);
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
/**
|
|
303
|
-
* Create comprehensive integration test suite
|
|
304
|
-
*/
|
|
305
|
-
async createIntegrationTestSuite(
|
|
306
|
-
name: string,
|
|
307
|
-
description: string,
|
|
308
|
-
options: {
|
|
309
|
-
includePerformanceTests?: boolean;
|
|
310
|
-
includeSecurityTests?: boolean;
|
|
311
|
-
includeRegressionTests?: boolean;
|
|
312
|
-
environment?: string;
|
|
313
|
-
customTests?: IntegrationTest[];
|
|
314
|
-
} = {}
|
|
315
|
-
): Promise<IntegrationTestSuite> {
|
|
316
|
-
this.logger.info('🧪 Creating comprehensive integration test suite', { name, options });
|
|
317
|
-
|
|
318
|
-
const suiteId = `suite_${Date.now()}_${Math.random().toString(36).substr(2, 8)}`;
|
|
319
|
-
|
|
320
|
-
try {
|
|
321
|
-
// Create test categories
|
|
322
|
-
const testCategories = await this.createTestCategories(options);
|
|
323
|
-
|
|
324
|
-
// Configure the current instance with the test suite
|
|
325
|
-
(this as any).id = suiteId;
|
|
326
|
-
(this as any).name = name;
|
|
327
|
-
(this as any).description = description;
|
|
328
|
-
(this as any).version = '1.0.0';
|
|
329
|
-
(this as any).testCategories = testCategories;
|
|
330
|
-
(this as any).configuration = this.createDefaultConfiguration(options.environment || 'testing');
|
|
331
|
-
(this as any).metadata = {
|
|
332
|
-
createdAt: new Date().toISOString(),
|
|
333
|
-
author: 'IntegrationTestSuite',
|
|
334
|
-
environment: options.environment || 'testing',
|
|
335
|
-
totalTests: testCategories.reduce((sum, cat) => sum + cat.tests.length, 0),
|
|
336
|
-
estimatedDuration: this.estimateSuiteDuration(testCategories)
|
|
337
|
-
};
|
|
338
|
-
|
|
339
|
-
// Store test suite
|
|
340
|
-
this.testSuites.set(suiteId, this);
|
|
341
|
-
await this.memory.store(`integration_suite_${suiteId}`, this, 2592000000); // 30 days
|
|
342
|
-
|
|
343
|
-
this.logger.info('✅ Integration test suite created', {
|
|
344
|
-
suiteId,
|
|
345
|
-
categories: testCategories.length,
|
|
346
|
-
totalTests: (this as any).metadata.totalTests,
|
|
347
|
-
estimatedDuration: (this as any).metadata.estimatedDuration
|
|
348
|
-
});
|
|
349
|
-
|
|
350
|
-
return this;
|
|
351
|
-
|
|
352
|
-
} catch (error) {
|
|
353
|
-
this.logger.error('❌ Failed to create integration test suite', error);
|
|
354
|
-
throw error;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
/**
|
|
359
|
-
* Execute integration test suite
|
|
360
|
-
*/
|
|
361
|
-
async executeTestSuite(
|
|
362
|
-
suiteId: string,
|
|
363
|
-
options: {
|
|
364
|
-
categories?: string[];
|
|
365
|
-
parallel?: boolean;
|
|
366
|
-
stopOnFailure?: boolean;
|
|
367
|
-
dryRun?: boolean;
|
|
368
|
-
generateReport?: boolean;
|
|
369
|
-
} = {}
|
|
370
|
-
): Promise<TestExecution> {
|
|
371
|
-
this.logger.info('🚀 Executing integration test suite', { suiteId, options });
|
|
372
|
-
|
|
373
|
-
const testSuite = this.testSuites.get(suiteId);
|
|
374
|
-
if (!testSuite) {
|
|
375
|
-
throw new Error(`Test suite not found: ${suiteId}`);
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
const executionId = `exec_${Date.now()}_${Math.random().toString(36).substr(2, 6)}`;
|
|
379
|
-
|
|
380
|
-
const execution: TestExecution = {
|
|
381
|
-
id: executionId,
|
|
382
|
-
suiteId,
|
|
383
|
-
startTime: new Date().toISOString(),
|
|
384
|
-
status: 'running',
|
|
385
|
-
progress: 0,
|
|
386
|
-
results: [],
|
|
387
|
-
summary: {
|
|
388
|
-
totalTests: 0,
|
|
389
|
-
totalCategories: 0,
|
|
390
|
-
passed: 0,
|
|
391
|
-
failed: 0,
|
|
392
|
-
skipped: 0,
|
|
393
|
-
errors: 0,
|
|
394
|
-
successRate: 0,
|
|
395
|
-
totalDuration: 0,
|
|
396
|
-
averageTestDuration: 0,
|
|
397
|
-
criticalFailures: 0
|
|
398
|
-
},
|
|
399
|
-
issues: [],
|
|
400
|
-
artifacts: []
|
|
401
|
-
};
|
|
402
|
-
|
|
403
|
-
this.executions.set(executionId, execution);
|
|
404
|
-
|
|
405
|
-
try {
|
|
406
|
-
// Filter categories if specified
|
|
407
|
-
let categoriesToRun = testSuite.testCategories;
|
|
408
|
-
if (options.categories && options.categories.length > 0) {
|
|
409
|
-
categoriesToRun = testSuite.testCategories.filter(cat =>
|
|
410
|
-
options.categories!.includes(cat.name)
|
|
411
|
-
);
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
execution.summary.totalCategories = categoriesToRun.length;
|
|
415
|
-
execution.summary.totalTests = categoriesToRun.reduce((sum, cat) => sum + cat.tests.length, 0);
|
|
416
|
-
|
|
417
|
-
// Execute categories
|
|
418
|
-
if (options.parallel && testSuite.configuration.parallelism.categoryLevel) {
|
|
419
|
-
// Parallel category execution
|
|
420
|
-
const promises = categoriesToRun.map(category =>
|
|
421
|
-
this.executeTestCategory(category, execution, options)
|
|
422
|
-
);
|
|
423
|
-
|
|
424
|
-
const results = await Promise.allSettled(promises);
|
|
425
|
-
execution.results = results
|
|
426
|
-
.filter(result => result.status === 'fulfilled')
|
|
427
|
-
.map(result => (result as PromiseFulfilledResult<CategoryResult>).value);
|
|
428
|
-
} else {
|
|
429
|
-
// Sequential category execution
|
|
430
|
-
for (const category of categoriesToRun) {
|
|
431
|
-
const categoryResult = await this.executeTestCategory(category, execution, options);
|
|
432
|
-
execution.results.push(categoryResult);
|
|
433
|
-
|
|
434
|
-
// Update progress
|
|
435
|
-
execution.progress = (execution.results.length / categoriesToRun.length) * 100;
|
|
436
|
-
|
|
437
|
-
// Stop on failure if requested
|
|
438
|
-
if (options.stopOnFailure && categoryResult.status === 'failed') {
|
|
439
|
-
this.logger.warn('Stopping test execution due to category failure', {
|
|
440
|
-
category: category.name
|
|
441
|
-
});
|
|
442
|
-
break;
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
// Calculate final summary
|
|
448
|
-
execution.summary = this.calculateExecutionSummary(execution.results);
|
|
449
|
-
execution.status = execution.summary.failed > 0 ? 'failed' : 'completed';
|
|
450
|
-
execution.endTime = new Date().toISOString();
|
|
451
|
-
execution.progress = 100;
|
|
452
|
-
|
|
453
|
-
// Generate report if requested
|
|
454
|
-
if (options.generateReport) {
|
|
455
|
-
await this.generateTestReport(execution);
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
this.logger.info('✅ Integration test suite execution completed', {
|
|
459
|
-
executionId,
|
|
460
|
-
status: execution.status,
|
|
461
|
-
passed: execution.summary.passed,
|
|
462
|
-
failed: execution.summary.failed,
|
|
463
|
-
successRate: execution.summary.successRate,
|
|
464
|
-
duration: execution.summary.totalDuration
|
|
465
|
-
});
|
|
466
|
-
|
|
467
|
-
return execution;
|
|
468
|
-
|
|
469
|
-
} catch (error) {
|
|
470
|
-
execution.status = 'failed';
|
|
471
|
-
execution.endTime = new Date().toISOString();
|
|
472
|
-
|
|
473
|
-
execution.issues.push({
|
|
474
|
-
severity: 'critical',
|
|
475
|
-
category: 'execution',
|
|
476
|
-
description: `Test suite execution failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
477
|
-
recommendation: 'Check system configuration and dependencies',
|
|
478
|
-
autoResolvable: false
|
|
479
|
-
});
|
|
480
|
-
|
|
481
|
-
this.logger.error('❌ Integration test suite execution failed', error);
|
|
482
|
-
throw error;
|
|
483
|
-
|
|
484
|
-
} finally {
|
|
485
|
-
// Store execution results
|
|
486
|
-
await this.memory.store(`integration_execution_${executionId}`, execution, 2592000000); // 30 days
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
/**
|
|
491
|
-
* Get test suites with filtering
|
|
492
|
-
*/
|
|
493
|
-
getTestSuites(filter?: {
|
|
494
|
-
name?: string;
|
|
495
|
-
environment?: string;
|
|
496
|
-
minTests?: number;
|
|
497
|
-
}): IntegrationTestSuite[] {
|
|
498
|
-
let suites = Array.from(this.testSuites.values());
|
|
499
|
-
|
|
500
|
-
if (filter) {
|
|
501
|
-
if (filter.name) {
|
|
502
|
-
suites = suites.filter(s =>
|
|
503
|
-
s.name.toLowerCase().includes(filter.name!.toLowerCase())
|
|
504
|
-
);
|
|
505
|
-
}
|
|
506
|
-
if (filter.environment) {
|
|
507
|
-
suites = suites.filter(s => s.metadata.environment === filter.environment);
|
|
508
|
-
}
|
|
509
|
-
if (filter.minTests) {
|
|
510
|
-
suites = suites.filter(s => s.metadata.totalTests >= filter.minTests!);
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
return suites.sort((a, b) =>
|
|
515
|
-
new Date(b.metadata.createdAt).getTime() - new Date(a.metadata.createdAt).getTime()
|
|
516
|
-
);
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
/**
|
|
520
|
-
* Get test executions
|
|
521
|
-
*/
|
|
522
|
-
getTestExecutions(): TestExecution[] {
|
|
523
|
-
return Array.from(this.executions.values())
|
|
524
|
-
.sort((a, b) => new Date(b.startTime).getTime() - new Date(a.startTime).getTime());
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
/**
|
|
528
|
-
* Private helper methods
|
|
529
|
-
*/
|
|
530
|
-
|
|
531
|
-
private async createTestCategories(options: any): Promise<TestCategory[]> {
|
|
532
|
-
const categories: TestCategory[] = [];
|
|
533
|
-
|
|
534
|
-
// Core Component Tests
|
|
535
|
-
categories.push({
|
|
536
|
-
name: 'Core Components',
|
|
537
|
-
description: 'Tests for core system components and their interactions',
|
|
538
|
-
tests: await this.createCoreComponentTests(),
|
|
539
|
-
dependencies: [],
|
|
540
|
-
priority: 'critical',
|
|
541
|
-
parallelExecution: false
|
|
542
|
-
});
|
|
543
|
-
|
|
544
|
-
// API Integration Tests
|
|
545
|
-
categories.push({
|
|
546
|
-
name: 'API Integration',
|
|
547
|
-
description: 'Tests for ServiceNow API integration and communication',
|
|
548
|
-
tests: await this.createAPIIntegrationTests(),
|
|
549
|
-
dependencies: ['Core Components'],
|
|
550
|
-
priority: 'high',
|
|
551
|
-
parallelExecution: true
|
|
552
|
-
});
|
|
553
|
-
|
|
554
|
-
// Flow Template Tests
|
|
555
|
-
categories.push({
|
|
556
|
-
name: 'Flow Templates',
|
|
557
|
-
description: 'Tests for flow template system and generation',
|
|
558
|
-
tests: await this.createFlowTemplateTests(),
|
|
559
|
-
dependencies: ['Core Components'],
|
|
560
|
-
priority: 'high',
|
|
561
|
-
parallelExecution: true
|
|
562
|
-
});
|
|
563
|
-
|
|
564
|
-
// Update Orchestration Tests
|
|
565
|
-
categories.push({
|
|
566
|
-
name: 'Update Orchestration',
|
|
567
|
-
description: 'Tests for flow update orchestration and rollback',
|
|
568
|
-
tests: await this.createUpdateOrchestrationTests(),
|
|
569
|
-
dependencies: ['Flow Templates'],
|
|
570
|
-
priority: 'high',
|
|
571
|
-
parallelExecution: false
|
|
572
|
-
});
|
|
573
|
-
|
|
574
|
-
// Performance Tests
|
|
575
|
-
if (options.includePerformanceTests !== false) {
|
|
576
|
-
categories.push({
|
|
577
|
-
name: 'Performance',
|
|
578
|
-
description: 'Performance and optimization tests',
|
|
579
|
-
tests: await this.createPerformanceTests(),
|
|
580
|
-
dependencies: ['Core Components'],
|
|
581
|
-
priority: 'medium',
|
|
582
|
-
parallelExecution: true
|
|
583
|
-
});
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
// Security Tests
|
|
587
|
-
if (options.includeSecurityTests) {
|
|
588
|
-
categories.push({
|
|
589
|
-
name: 'Security',
|
|
590
|
-
description: 'Security validation and vulnerability tests',
|
|
591
|
-
tests: await this.createSecurityTests(),
|
|
592
|
-
dependencies: ['API Integration'],
|
|
593
|
-
priority: 'high',
|
|
594
|
-
parallelExecution: false
|
|
595
|
-
});
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
// Regression Tests
|
|
599
|
-
if (options.includeRegressionTests) {
|
|
600
|
-
categories.push({
|
|
601
|
-
name: 'Regression',
|
|
602
|
-
description: 'Regression tests to ensure no functionality breaks',
|
|
603
|
-
tests: await this.createRegressionTests(),
|
|
604
|
-
dependencies: ['Core Components', 'API Integration'],
|
|
605
|
-
priority: 'medium',
|
|
606
|
-
parallelExecution: true
|
|
607
|
-
});
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
return categories;
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
private async createCoreComponentTests(): Promise<IntegrationTest[]> {
|
|
614
|
-
return [
|
|
615
|
-
{
|
|
616
|
-
id: 'core_001',
|
|
617
|
-
name: 'Memory System Integration',
|
|
618
|
-
description: 'Tests memory system integration and agent isolation',
|
|
619
|
-
type: 'component',
|
|
620
|
-
steps: [
|
|
621
|
-
{
|
|
622
|
-
order: 1,
|
|
623
|
-
name: 'Initialize Memory System',
|
|
624
|
-
action: 'memory.initialize',
|
|
625
|
-
parameters: {},
|
|
626
|
-
validation: 'Memory system is operational'
|
|
627
|
-
},
|
|
628
|
-
{
|
|
629
|
-
order: 2,
|
|
630
|
-
name: 'Test Agent Isolation',
|
|
631
|
-
action: 'memory.storeShared',
|
|
632
|
-
parameters: { agentId: 'test_agent', key: 'test_key', value: 'test_value' },
|
|
633
|
-
validation: 'Data stored with agent isolation'
|
|
634
|
-
},
|
|
635
|
-
{
|
|
636
|
-
order: 3,
|
|
637
|
-
name: 'Verify Isolation',
|
|
638
|
-
action: 'memory.retrieveShared',
|
|
639
|
-
parameters: { agentId: 'different_agent', key: 'test_key' },
|
|
640
|
-
expectedResult: null,
|
|
641
|
-
validation: 'Agent isolation working correctly'
|
|
642
|
-
}
|
|
643
|
-
],
|
|
644
|
-
setup: {
|
|
645
|
-
prerequisites: ['Clean memory state'],
|
|
646
|
-
dataPreparation: [],
|
|
647
|
-
systemConfiguration: [],
|
|
648
|
-
mockServices: []
|
|
649
|
-
},
|
|
650
|
-
teardown: {
|
|
651
|
-
cleanupActions: [
|
|
652
|
-
{
|
|
653
|
-
action: 'memory.cleanup',
|
|
654
|
-
parameters: { pattern: 'test_*' },
|
|
655
|
-
order: 1,
|
|
656
|
-
critical: true
|
|
657
|
-
}
|
|
658
|
-
],
|
|
659
|
-
dataRestoration: [],
|
|
660
|
-
systemReset: [],
|
|
661
|
-
verificationChecks: []
|
|
662
|
-
},
|
|
663
|
-
assertions: [
|
|
664
|
-
{
|
|
665
|
-
type: 'exists',
|
|
666
|
-
target: 'memory.connection',
|
|
667
|
-
expected: true,
|
|
668
|
-
message: 'Memory system connection exists',
|
|
669
|
-
critical: true
|
|
670
|
-
}
|
|
671
|
-
],
|
|
672
|
-
timeout: 30000,
|
|
673
|
-
retryCount: 2,
|
|
674
|
-
tags: ['core', 'memory', 'isolation']
|
|
675
|
-
}
|
|
676
|
-
];
|
|
677
|
-
}
|
|
678
|
-
|
|
679
|
-
private async createAPIIntegrationTests(): Promise<IntegrationTest[]> {
|
|
680
|
-
return [
|
|
681
|
-
{
|
|
682
|
-
id: 'api_001',
|
|
683
|
-
name: 'ServiceNow Authentication',
|
|
684
|
-
description: 'Tests ServiceNow OAuth authentication flow',
|
|
685
|
-
type: 'api',
|
|
686
|
-
steps: [
|
|
687
|
-
{
|
|
688
|
-
order: 1,
|
|
689
|
-
name: 'Test OAuth Token Retrieval',
|
|
690
|
-
action: 'oauth.getAccessToken',
|
|
691
|
-
parameters: {},
|
|
692
|
-
validation: 'Access token retrieved successfully'
|
|
693
|
-
},
|
|
694
|
-
{
|
|
695
|
-
order: 2,
|
|
696
|
-
name: 'Test API Call with Token',
|
|
697
|
-
action: 'client.makeRequest',
|
|
698
|
-
parameters: { method: 'GET', endpoint: '/api/now/table/sys_user?sysparm_limit=1' },
|
|
699
|
-
validation: 'API call successful with authentication'
|
|
700
|
-
}
|
|
701
|
-
],
|
|
702
|
-
setup: {
|
|
703
|
-
prerequisites: ['Valid ServiceNow credentials configured'],
|
|
704
|
-
dataPreparation: [],
|
|
705
|
-
systemConfiguration: [],
|
|
706
|
-
mockServices: []
|
|
707
|
-
},
|
|
708
|
-
teardown: {
|
|
709
|
-
cleanupActions: [],
|
|
710
|
-
dataRestoration: [],
|
|
711
|
-
systemReset: [],
|
|
712
|
-
verificationChecks: []
|
|
713
|
-
},
|
|
714
|
-
assertions: [
|
|
715
|
-
{
|
|
716
|
-
type: 'exists',
|
|
717
|
-
target: 'response.result',
|
|
718
|
-
expected: true,
|
|
719
|
-
message: 'API response contains result data',
|
|
720
|
-
critical: true
|
|
721
|
-
}
|
|
722
|
-
],
|
|
723
|
-
timeout: 15000,
|
|
724
|
-
retryCount: 3,
|
|
725
|
-
tags: ['api', 'authentication', 'oauth']
|
|
726
|
-
}
|
|
727
|
-
];
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
private async createFlowTemplateTests(): Promise<IntegrationTest[]> {
|
|
731
|
-
return [
|
|
732
|
-
{
|
|
733
|
-
id: 'template_001',
|
|
734
|
-
name: 'iPhone Approval Template Generation',
|
|
735
|
-
description: 'Tests iPhone approval template generation and customization',
|
|
736
|
-
type: 'workflow',
|
|
737
|
-
steps: [
|
|
738
|
-
{
|
|
739
|
-
order: 1,
|
|
740
|
-
name: 'Generate Flow from Template',
|
|
741
|
-
action: 'templateSystem.generateFlowFromTemplate',
|
|
742
|
-
parameters: {
|
|
743
|
-
templateId: 'iphone_approval_flow',
|
|
744
|
-
variables: {
|
|
745
|
-
approval_group: 'IT Managers',
|
|
746
|
-
fulfillment_group: 'IT Support'
|
|
747
|
-
}
|
|
748
|
-
},
|
|
749
|
-
validation: 'Flow generated successfully from template'
|
|
750
|
-
}
|
|
751
|
-
],
|
|
752
|
-
setup: {
|
|
753
|
-
prerequisites: ['Template system initialized'],
|
|
754
|
-
dataPreparation: [],
|
|
755
|
-
systemConfiguration: [],
|
|
756
|
-
mockServices: []
|
|
757
|
-
},
|
|
758
|
-
teardown: {
|
|
759
|
-
cleanupActions: [],
|
|
760
|
-
dataRestoration: [],
|
|
761
|
-
systemReset: [],
|
|
762
|
-
verificationChecks: []
|
|
763
|
-
},
|
|
764
|
-
assertions: [
|
|
765
|
-
{
|
|
766
|
-
type: 'exists',
|
|
767
|
-
target: 'result.flowDefinition',
|
|
768
|
-
expected: true,
|
|
769
|
-
message: 'Flow definition generated',
|
|
770
|
-
critical: true
|
|
771
|
-
}
|
|
772
|
-
],
|
|
773
|
-
timeout: 45000,
|
|
774
|
-
retryCount: 2,
|
|
775
|
-
tags: ['template', 'flow_generation', 'iphone']
|
|
776
|
-
}
|
|
777
|
-
];
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
private async createUpdateOrchestrationTests(): Promise<IntegrationTest[]> {
|
|
781
|
-
return [
|
|
782
|
-
{
|
|
783
|
-
id: 'orchestration_001',
|
|
784
|
-
name: 'Flow Update with Rollback',
|
|
785
|
-
description: 'Tests flow update orchestration with automatic rollback capability',
|
|
786
|
-
type: 'system',
|
|
787
|
-
steps: [
|
|
788
|
-
{
|
|
789
|
-
order: 1,
|
|
790
|
-
name: 'Create Rollback Point',
|
|
791
|
-
action: 'rollbackSystem.createRollbackPoint',
|
|
792
|
-
parameters: { name: 'Test Rollback Point', description: 'Integration test rollback' },
|
|
793
|
-
validation: 'Rollback point created successfully'
|
|
794
|
-
},
|
|
795
|
-
{
|
|
796
|
-
order: 2,
|
|
797
|
-
name: 'Plan Flow Update',
|
|
798
|
-
action: 'updateOrchestrator.planFlowUpdate',
|
|
799
|
-
parameters: { flowId: 'test_flow', newDefinition: {} },
|
|
800
|
-
validation: 'Update plan created'
|
|
801
|
-
},
|
|
802
|
-
{
|
|
803
|
-
order: 3,
|
|
804
|
-
name: 'Execute Update with Rollback Test',
|
|
805
|
-
action: 'updateOrchestrator.executeFlowUpdate',
|
|
806
|
-
parameters: { planId: 'test_plan', dryRun: true },
|
|
807
|
-
validation: 'Update execution completed or rollback successful'
|
|
808
|
-
}
|
|
809
|
-
],
|
|
810
|
-
setup: {
|
|
811
|
-
prerequisites: ['Test flow exists'],
|
|
812
|
-
dataPreparation: [],
|
|
813
|
-
systemConfiguration: [],
|
|
814
|
-
mockServices: []
|
|
815
|
-
},
|
|
816
|
-
teardown: {
|
|
817
|
-
cleanupActions: [
|
|
818
|
-
{
|
|
819
|
-
action: 'cleanup.rollbackPoints',
|
|
820
|
-
parameters: { pattern: 'Test*' },
|
|
821
|
-
order: 1,
|
|
822
|
-
critical: true
|
|
823
|
-
}
|
|
824
|
-
],
|
|
825
|
-
dataRestoration: [],
|
|
826
|
-
systemReset: [],
|
|
827
|
-
verificationChecks: []
|
|
828
|
-
},
|
|
829
|
-
assertions: [
|
|
830
|
-
{
|
|
831
|
-
type: 'exists',
|
|
832
|
-
target: 'rollbackPoint.id',
|
|
833
|
-
expected: true,
|
|
834
|
-
message: 'Rollback point created',
|
|
835
|
-
critical: true
|
|
836
|
-
}
|
|
837
|
-
],
|
|
838
|
-
timeout: 120000,
|
|
839
|
-
retryCount: 1,
|
|
840
|
-
tags: ['orchestration', 'rollback', 'update']
|
|
841
|
-
}
|
|
842
|
-
];
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
private async createPerformanceTests(): Promise<IntegrationTest[]> {
|
|
846
|
-
return [
|
|
847
|
-
{
|
|
848
|
-
id: 'perf_001',
|
|
849
|
-
name: 'Flow Performance Analysis',
|
|
850
|
-
description: 'Tests performance _analysis and optimization recommendations',
|
|
851
|
-
type: 'performance',
|
|
852
|
-
steps: [
|
|
853
|
-
{
|
|
854
|
-
order: 1,
|
|
855
|
-
name: 'Analyze Flow Performance',
|
|
856
|
-
action: 'performanceOptimizer.analyzeFlowPerformance',
|
|
857
|
-
parameters: { flowDefinition: {} },
|
|
858
|
-
validation: 'Performance _analysis completed'
|
|
859
|
-
}
|
|
860
|
-
],
|
|
861
|
-
setup: {
|
|
862
|
-
prerequisites: ['Performance monitoring enabled'],
|
|
863
|
-
dataPreparation: [],
|
|
864
|
-
systemConfiguration: [],
|
|
865
|
-
mockServices: []
|
|
866
|
-
},
|
|
867
|
-
teardown: {
|
|
868
|
-
cleanupActions: [],
|
|
869
|
-
dataRestoration: [],
|
|
870
|
-
systemReset: [],
|
|
871
|
-
verificationChecks: []
|
|
872
|
-
},
|
|
873
|
-
assertions: [
|
|
874
|
-
{
|
|
875
|
-
type: 'greater_than',
|
|
876
|
-
target: 'profile.optimizations.length',
|
|
877
|
-
expected: 0,
|
|
878
|
-
message: 'Performance optimizations identified',
|
|
879
|
-
critical: false
|
|
880
|
-
}
|
|
881
|
-
],
|
|
882
|
-
timeout: 60000,
|
|
883
|
-
retryCount: 2,
|
|
884
|
-
tags: ['performance', 'optimization', '_analysis']
|
|
885
|
-
}
|
|
886
|
-
];
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
private async createSecurityTests(): Promise<IntegrationTest[]> {
|
|
890
|
-
return [
|
|
891
|
-
{
|
|
892
|
-
id: 'security_001',
|
|
893
|
-
name: 'SSL Certificate Validation',
|
|
894
|
-
description: 'Tests SSL/TLS certificate validation for ServiceNow connections',
|
|
895
|
-
type: 'security',
|
|
896
|
-
steps: [
|
|
897
|
-
{
|
|
898
|
-
order: 1,
|
|
899
|
-
name: 'Test Secure Connection',
|
|
900
|
-
action: 'client.testSecureConnection',
|
|
901
|
-
parameters: {},
|
|
902
|
-
validation: 'Secure connection established with valid certificate'
|
|
903
|
-
}
|
|
904
|
-
],
|
|
905
|
-
setup: {
|
|
906
|
-
prerequisites: ['HTTPS endpoint configured'],
|
|
907
|
-
dataPreparation: [],
|
|
908
|
-
systemConfiguration: [],
|
|
909
|
-
mockServices: []
|
|
910
|
-
},
|
|
911
|
-
teardown: {
|
|
912
|
-
cleanupActions: [],
|
|
913
|
-
dataRestoration: [],
|
|
914
|
-
systemReset: [],
|
|
915
|
-
verificationChecks: []
|
|
916
|
-
},
|
|
917
|
-
assertions: [
|
|
918
|
-
{
|
|
919
|
-
type: 'equals',
|
|
920
|
-
target: 'connection.secure',
|
|
921
|
-
expected: true,
|
|
922
|
-
message: 'Connection is secure',
|
|
923
|
-
critical: true
|
|
924
|
-
}
|
|
925
|
-
],
|
|
926
|
-
timeout: 15000,
|
|
927
|
-
retryCount: 1,
|
|
928
|
-
tags: ['security', 'ssl', 'certificate']
|
|
929
|
-
}
|
|
930
|
-
];
|
|
931
|
-
}
|
|
932
|
-
|
|
933
|
-
private async createRegressionTests(): Promise<IntegrationTest[]> {
|
|
934
|
-
return [
|
|
935
|
-
{
|
|
936
|
-
id: 'regression_001',
|
|
937
|
-
name: 'Core Functionality Regression',
|
|
938
|
-
description: 'Tests that core functionality still works after updates',
|
|
939
|
-
type: 'system',
|
|
940
|
-
steps: [
|
|
941
|
-
{
|
|
942
|
-
order: 1,
|
|
943
|
-
name: 'Test Basic Flow Creation',
|
|
944
|
-
action: 'templateSystem.getTemplates',
|
|
945
|
-
parameters: {},
|
|
946
|
-
validation: 'Templates retrieved successfully'
|
|
947
|
-
},
|
|
948
|
-
{
|
|
949
|
-
order: 2,
|
|
950
|
-
name: 'Test Memory Operations',
|
|
951
|
-
action: 'memory.store',
|
|
952
|
-
parameters: { key: 'regression_test', value: 'test_data' },
|
|
953
|
-
validation: 'Memory operations working'
|
|
954
|
-
}
|
|
955
|
-
],
|
|
956
|
-
setup: {
|
|
957
|
-
prerequisites: [],
|
|
958
|
-
dataPreparation: [],
|
|
959
|
-
systemConfiguration: [],
|
|
960
|
-
mockServices: []
|
|
961
|
-
},
|
|
962
|
-
teardown: {
|
|
963
|
-
cleanupActions: [
|
|
964
|
-
{
|
|
965
|
-
action: 'memory.delete',
|
|
966
|
-
parameters: { key: 'regression_test' },
|
|
967
|
-
order: 1,
|
|
968
|
-
critical: false
|
|
969
|
-
}
|
|
970
|
-
],
|
|
971
|
-
dataRestoration: [],
|
|
972
|
-
systemReset: [],
|
|
973
|
-
verificationChecks: []
|
|
974
|
-
},
|
|
975
|
-
assertions: [
|
|
976
|
-
{
|
|
977
|
-
type: 'greater_than',
|
|
978
|
-
target: 'templates.length',
|
|
979
|
-
expected: 0,
|
|
980
|
-
message: 'Templates available',
|
|
981
|
-
critical: true
|
|
982
|
-
}
|
|
983
|
-
],
|
|
984
|
-
timeout: 30000,
|
|
985
|
-
retryCount: 3,
|
|
986
|
-
tags: ['regression', 'core', 'functionality']
|
|
987
|
-
}
|
|
988
|
-
];
|
|
989
|
-
}
|
|
990
|
-
|
|
991
|
-
private createDefaultConfiguration(environment: string): TestConfiguration {
|
|
992
|
-
return {
|
|
993
|
-
environment: environment as any,
|
|
994
|
-
parallelism: {
|
|
995
|
-
enabled: true,
|
|
996
|
-
maxConcurrency: 4,
|
|
997
|
-
categoryLevel: true,
|
|
998
|
-
testLevel: false
|
|
999
|
-
},
|
|
1000
|
-
reporting: {
|
|
1001
|
-
format: 'json',
|
|
1002
|
-
outputPath: './test-results',
|
|
1003
|
-
includeDetails: true,
|
|
1004
|
-
screenshotOnFailure: false
|
|
1005
|
-
},
|
|
1006
|
-
retry: {
|
|
1007
|
-
enabled: true,
|
|
1008
|
-
maxAttempts: 3,
|
|
1009
|
-
backoffStrategy: 'exponential',
|
|
1010
|
-
backoffDelay: 1000
|
|
1011
|
-
},
|
|
1012
|
-
timeouts: {
|
|
1013
|
-
default: 30000,
|
|
1014
|
-
setup: 60000,
|
|
1015
|
-
teardown: 30000,
|
|
1016
|
-
assertion: 5000
|
|
1017
|
-
}
|
|
1018
|
-
};
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
private estimateSuiteDuration(categories: TestCategory[]): number {
|
|
1022
|
-
return categories.reduce((total, category) => {
|
|
1023
|
-
const categoryDuration = category.tests.reduce((catTotal, test) =>
|
|
1024
|
-
catTotal + test.timeout + 5000, 0); // Add 5s overhead per test
|
|
1025
|
-
return total + categoryDuration;
|
|
1026
|
-
}, 0);
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1029
|
-
private async executeTestCategory(
|
|
1030
|
-
category: TestCategory,
|
|
1031
|
-
execution: TestExecution,
|
|
1032
|
-
options: any
|
|
1033
|
-
): Promise<CategoryResult> {
|
|
1034
|
-
this.logger.info(`Executing test category: ${category.name}`);
|
|
1035
|
-
|
|
1036
|
-
const categoryResult: CategoryResult = {
|
|
1037
|
-
categoryName: category.name,
|
|
1038
|
-
status: 'running',
|
|
1039
|
-
startTime: new Date().toISOString(),
|
|
1040
|
-
testResults: [],
|
|
1041
|
-
summary: {
|
|
1042
|
-
total: category.tests.length,
|
|
1043
|
-
passed: 0,
|
|
1044
|
-
failed: 0,
|
|
1045
|
-
skipped: 0,
|
|
1046
|
-
errors: 0
|
|
1047
|
-
}
|
|
1048
|
-
};
|
|
1049
|
-
|
|
1050
|
-
try {
|
|
1051
|
-
// Execute tests in category
|
|
1052
|
-
if (category.parallelExecution && options.parallel) {
|
|
1053
|
-
// Parallel test execution
|
|
1054
|
-
const promises = category.tests.map(test =>
|
|
1055
|
-
this.executeIntegrationTest(test, options.dryRun || false)
|
|
1056
|
-
);
|
|
1057
|
-
|
|
1058
|
-
const results = await Promise.allSettled(promises);
|
|
1059
|
-
categoryResult.testResults = results
|
|
1060
|
-
.filter(result => result.status === 'fulfilled')
|
|
1061
|
-
.map(result => (result as PromiseFulfilledResult<TestResult>).value);
|
|
1062
|
-
} else {
|
|
1063
|
-
// Sequential test execution
|
|
1064
|
-
for (const test of category.tests) {
|
|
1065
|
-
const testResult = await this.executeIntegrationTest(test, options.dryRun || false);
|
|
1066
|
-
categoryResult.testResults.push(testResult);
|
|
1067
|
-
|
|
1068
|
-
// Stop on failure if requested
|
|
1069
|
-
if (options.stopOnFailure && testResult.status === 'failed') {
|
|
1070
|
-
break;
|
|
1071
|
-
}
|
|
1072
|
-
}
|
|
1073
|
-
}
|
|
1074
|
-
|
|
1075
|
-
// Calculate category summary
|
|
1076
|
-
categoryResult.summary = {
|
|
1077
|
-
total: categoryResult.testResults.length,
|
|
1078
|
-
passed: categoryResult.testResults.filter(r => r.status === 'passed').length,
|
|
1079
|
-
failed: categoryResult.testResults.filter(r => r.status === 'failed').length,
|
|
1080
|
-
skipped: categoryResult.testResults.filter(r => r.status === 'skipped').length,
|
|
1081
|
-
errors: categoryResult.testResults.filter(r => r.status === 'error').length
|
|
1082
|
-
};
|
|
1083
|
-
|
|
1084
|
-
categoryResult.status = categoryResult.summary.failed > 0 ? 'failed' : 'completed';
|
|
1085
|
-
categoryResult.endTime = new Date().toISOString();
|
|
1086
|
-
|
|
1087
|
-
return categoryResult;
|
|
1088
|
-
|
|
1089
|
-
} catch (error) {
|
|
1090
|
-
categoryResult.status = 'failed';
|
|
1091
|
-
categoryResult.endTime = new Date().toISOString();
|
|
1092
|
-
|
|
1093
|
-
this.logger.error(`Category execution failed: ${category.name}`, error);
|
|
1094
|
-
return categoryResult;
|
|
1095
|
-
}
|
|
1096
|
-
}
|
|
1097
|
-
|
|
1098
|
-
private async executeIntegrationTest(test: IntegrationTest, dryRun: boolean): Promise<TestResult> {
|
|
1099
|
-
const startTime = new Date().toISOString();
|
|
1100
|
-
|
|
1101
|
-
const testResult: TestResult = {
|
|
1102
|
-
testId: test.id,
|
|
1103
|
-
name: test.name,
|
|
1104
|
-
status: 'passed',
|
|
1105
|
-
startTime,
|
|
1106
|
-
endTime: startTime,
|
|
1107
|
-
duration: 0,
|
|
1108
|
-
stepResults: [],
|
|
1109
|
-
assertionResults: [],
|
|
1110
|
-
logs: [],
|
|
1111
|
-
artifacts: []
|
|
1112
|
-
};
|
|
1113
|
-
|
|
1114
|
-
try {
|
|
1115
|
-
this.logger.info(`Executing test: ${test.name}`, { dryRun });
|
|
1116
|
-
|
|
1117
|
-
if (dryRun) {
|
|
1118
|
-
// Simulate test execution
|
|
1119
|
-
testResult.logs.push('Dry run - test simulation completed');
|
|
1120
|
-
testResult.endTime = new Date().toISOString();
|
|
1121
|
-
testResult.duration = 1000;
|
|
1122
|
-
return testResult;
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
|
-
// Execute test setup
|
|
1126
|
-
await this.executeTestSetup(test.setup);
|
|
1127
|
-
|
|
1128
|
-
// Execute test steps
|
|
1129
|
-
for (const step of test.steps) {
|
|
1130
|
-
const stepResult = await this.executeTestStep(step);
|
|
1131
|
-
testResult.stepResults.push(stepResult);
|
|
1132
|
-
|
|
1133
|
-
if (stepResult.status === 'failed' && !step.optional) {
|
|
1134
|
-
testResult.status = 'failed';
|
|
1135
|
-
break;
|
|
1136
|
-
}
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
|
-
// Execute assertions
|
|
1140
|
-
for (const assertion of test.assertions) {
|
|
1141
|
-
const assertionResult = await this.executeAssertion(assertion);
|
|
1142
|
-
testResult.assertionResults.push(assertionResult);
|
|
1143
|
-
|
|
1144
|
-
if (!assertionResult.passed && assertion.critical) {
|
|
1145
|
-
testResult.status = 'failed';
|
|
1146
|
-
}
|
|
1147
|
-
}
|
|
1148
|
-
|
|
1149
|
-
// Execute test teardown
|
|
1150
|
-
await this.executeTestTeardown(test.teardown);
|
|
1151
|
-
|
|
1152
|
-
testResult.endTime = new Date().toISOString();
|
|
1153
|
-
testResult.duration = new Date(testResult.endTime).getTime() - new Date(testResult.startTime).getTime();
|
|
1154
|
-
|
|
1155
|
-
return testResult;
|
|
1156
|
-
|
|
1157
|
-
} catch (error) {
|
|
1158
|
-
testResult.status = 'error';
|
|
1159
|
-
testResult.error = error instanceof Error ? error.message : String(error);
|
|
1160
|
-
testResult.endTime = new Date().toISOString();
|
|
1161
|
-
testResult.duration = new Date(testResult.endTime).getTime() - new Date(testResult.startTime).getTime();
|
|
1162
|
-
|
|
1163
|
-
this.logger.error(`Test execution failed: ${test.name}`, error);
|
|
1164
|
-
return testResult;
|
|
1165
|
-
}
|
|
1166
|
-
}
|
|
1167
|
-
|
|
1168
|
-
private async executeTestSetup(setup: TestSetup): Promise<void> {
|
|
1169
|
-
// Setup implementation would go here
|
|
1170
|
-
this.logger.debug('Executing test setup');
|
|
1171
|
-
}
|
|
1172
|
-
|
|
1173
|
-
private async executeTestStep(step: TestStep): Promise<StepResult> {
|
|
1174
|
-
const startTime = Date.now();
|
|
1175
|
-
|
|
1176
|
-
try {
|
|
1177
|
-
// Step execution logic would go here based on step.action
|
|
1178
|
-
this.logger.debug(`Executing step: ${step.name}`);
|
|
1179
|
-
|
|
1180
|
-
// Simulate step execution
|
|
1181
|
-
await new Promise(resolve => setTimeout(resolve, 100));
|
|
1182
|
-
|
|
1183
|
-
return {
|
|
1184
|
-
stepOrder: step.order,
|
|
1185
|
-
name: step.name,
|
|
1186
|
-
status: 'passed',
|
|
1187
|
-
duration: Date.now() - startTime,
|
|
1188
|
-
result: { success: true },
|
|
1189
|
-
validationPassed: true
|
|
1190
|
-
};
|
|
1191
|
-
|
|
1192
|
-
} catch (error) {
|
|
1193
|
-
return {
|
|
1194
|
-
stepOrder: step.order,
|
|
1195
|
-
name: step.name,
|
|
1196
|
-
status: 'failed',
|
|
1197
|
-
duration: Date.now() - startTime,
|
|
1198
|
-
error: error instanceof Error ? error.message : String(error),
|
|
1199
|
-
validationPassed: false
|
|
1200
|
-
};
|
|
1201
|
-
}
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1204
|
-
private async executeAssertion(assertion: TestAssertion): Promise<AssertionResult> {
|
|
1205
|
-
try {
|
|
1206
|
-
// Assertion execution logic would go here
|
|
1207
|
-
const actualValue = null; // Would get actual value based on assertion.target
|
|
1208
|
-
const passed = true; // Would evaluate assertion
|
|
1209
|
-
|
|
1210
|
-
return {
|
|
1211
|
-
type: assertion.type,
|
|
1212
|
-
target: assertion.target,
|
|
1213
|
-
expected: assertion.expected,
|
|
1214
|
-
actual: actualValue,
|
|
1215
|
-
passed,
|
|
1216
|
-
message: assertion.message,
|
|
1217
|
-
critical: assertion.critical
|
|
1218
|
-
};
|
|
1219
|
-
|
|
1220
|
-
} catch (error) {
|
|
1221
|
-
return {
|
|
1222
|
-
type: assertion.type,
|
|
1223
|
-
target: assertion.target,
|
|
1224
|
-
expected: assertion.expected,
|
|
1225
|
-
actual: null,
|
|
1226
|
-
passed: false,
|
|
1227
|
-
message: `Assertion failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
1228
|
-
critical: assertion.critical
|
|
1229
|
-
};
|
|
1230
|
-
}
|
|
1231
|
-
}
|
|
1232
|
-
|
|
1233
|
-
private async executeTestTeardown(teardown: TestTeardown): Promise<void> {
|
|
1234
|
-
// Teardown implementation would go here
|
|
1235
|
-
this.logger.debug('Executing test teardown');
|
|
1236
|
-
}
|
|
1237
|
-
|
|
1238
|
-
private calculateExecutionSummary(results: CategoryResult[]): ExecutionSummary {
|
|
1239
|
-
const summary = {
|
|
1240
|
-
totalTests: 0,
|
|
1241
|
-
totalCategories: results.length,
|
|
1242
|
-
passed: 0,
|
|
1243
|
-
failed: 0,
|
|
1244
|
-
skipped: 0,
|
|
1245
|
-
errors: 0,
|
|
1246
|
-
successRate: 0,
|
|
1247
|
-
totalDuration: 0,
|
|
1248
|
-
averageTestDuration: 0,
|
|
1249
|
-
criticalFailures: 0
|
|
1250
|
-
};
|
|
1251
|
-
|
|
1252
|
-
for (const categoryResult of results) {
|
|
1253
|
-
summary.totalTests += categoryResult.summary.total;
|
|
1254
|
-
summary.passed += categoryResult.summary.passed;
|
|
1255
|
-
summary.failed += categoryResult.summary.failed;
|
|
1256
|
-
summary.skipped += categoryResult.summary.skipped;
|
|
1257
|
-
summary.errors += categoryResult.summary.errors;
|
|
1258
|
-
|
|
1259
|
-
// Calculate duration from test results
|
|
1260
|
-
const categoryDuration = categoryResult.testResults.reduce((sum, test) => sum + test.duration, 0);
|
|
1261
|
-
summary.totalDuration += categoryDuration;
|
|
1262
|
-
}
|
|
1263
|
-
|
|
1264
|
-
summary.successRate = summary.totalTests > 0 ? (summary.passed / summary.totalTests) * 100 : 0;
|
|
1265
|
-
summary.averageTestDuration = summary.totalTests > 0 ? summary.totalDuration / summary.totalTests : 0;
|
|
1266
|
-
|
|
1267
|
-
return summary;
|
|
1268
|
-
}
|
|
1269
|
-
|
|
1270
|
-
private async generateTestReport(execution: TestExecution): Promise<void> {
|
|
1271
|
-
// Report generation implementation would go here
|
|
1272
|
-
this.logger.info('Generating test report', { executionId: execution.id });
|
|
1273
|
-
}
|
|
1274
|
-
}
|
|
1275
|
-
|
|
1276
|
-
export default IntegrationTestSuite;
|