|
4 | 4 | * 展示如何使用场景模板系统创建可复用的测试场景 |
5 | 5 | */ |
6 | 6 |
|
7 | | -import { describe, it, expect, beforeAll, afterAll } from 'vitest'; |
8 | | -import { |
9 | | - TestEngine, |
10 | | - ScenarioBuilder, |
11 | | - TestCategory, |
12 | | - ConsoleReporter, |
13 | | - TestSuiteResult |
14 | | -} from '../framework'; |
| 7 | +import {afterAll, beforeAll, describe, expect, it} from 'vitest'; |
| 8 | +import {ScenarioBuilder, TestCategory, TestEngine, TestSuiteResult} from '../framework'; |
15 | 9 |
|
16 | 10 | describe('CodingAgent 自定义场景测试 v2', () => { |
17 | 11 | let testEngine: TestEngine; |
18 | | - let testResults: TestSuiteResult; |
19 | 12 |
|
20 | 13 | beforeAll(async () => { |
21 | 14 | // 初始化测试引擎 |
@@ -111,30 +104,6 @@ describe('CodingAgent 自定义场景测试 v2', () => { |
111 | 104 | console.log(`✅ 错误恢复场景完成: ${results.passedTests}/${results.totalTests} 通过`); |
112 | 105 | }, 480000); // 8分钟超时 |
113 | 106 |
|
114 | | - it('应该成功运行自定义场景模板', async () => { |
115 | | - console.log('\n🎨 测试自定义场景模板...'); |
116 | | - |
117 | | - // 使用自定义注册的场景模板 |
118 | | - const testCases = [ |
119 | | - ScenarioBuilder.generateFromTemplate('microservice-setup', { |
120 | | - serviceName: 'UserService', |
121 | | - includeDocker: true, |
122 | | - includeTests: true |
123 | | - }), |
124 | | - ScenarioBuilder.generateFromTemplate('api-documentation', { |
125 | | - apiType: 'rest', |
126 | | - includeExamples: true |
127 | | - }) |
128 | | - ]; |
129 | | - |
130 | | - const results = await testEngine.runScenarios(testCases); |
131 | | - |
132 | | - expect(results.totalTests).toBe(2); |
133 | | - expect(results.passedTests).toBeGreaterThanOrEqual(1); // 至少50%通过率 |
134 | | - |
135 | | - console.log(`✅ 自定义场景完成: ${results.passedTests}/${results.totalTests} 通过`); |
136 | | - }, 720000); // 12分钟超时 |
137 | | - |
138 | 107 | it('应该验证场景模板的可扩展性', async () => { |
139 | 108 | // 验证所有注册的模板 |
140 | 109 | const allTemplates = ScenarioBuilder.getAllTemplates(); |
|
0 commit comments