import 'dart:io'; import 'package:test/test.dart'; import 'screens/equipment/equipment_in_full_test.dart'; /// 장비 테스트 실행기 void main() { group('장비 화면 자동 테스트', () { setUpAll(() async { // 테스트 시작 }); tearDownAll(() async { // 테스트 종료 }); test('장비 화면 전체 기능 테스트', () async { final equipmentTest = EquipmentInFullTest(); final results = await equipmentTest.runAllTests(); // 테스트 결과 요약 // 전체 테스트: ${results['totalTests']}개 // 성공: ${results['passedTests']}개 // 실패: ${results['failedTests']}개 // 상세 결과 출력 final tests = results['tests'] as List; for (final testResult in tests) { // Process test results if (!testResult['passed'] && testResult['error'] != null) { // 에러: ${testResult['error']} } } // 리포트 생성 final autoTestSystem = equipmentTest.autoTestSystem; final reportCollector = autoTestSystem.reportCollector; // HTML 리포트 생성 try { final htmlReport = await reportCollector.generateHtmlReport(); final htmlFile = File('test_reports/equipment_test_report.html'); await htmlFile.parent.create(recursive: true); await htmlFile.writeAsString(htmlReport); // HTML 리포트 생성: ${htmlFile.path} } catch (e) { // HTML 리포트 생성 실패: $e } // Markdown 리포트 생성 try { final mdReport = await reportCollector.generateMarkdownReport(); final mdFile = File('test_reports/equipment_test_report.md'); await mdFile.writeAsString(mdReport); // Markdown 리포트 생성: ${mdFile.path} } catch (e) { // Markdown 리포트 생성 실패: $e } // JSON 리포트 생성 try { final jsonReport = await reportCollector.generateJsonReport(); final jsonFile = File('test_reports/equipment_test_report.json'); await jsonFile.writeAsString(jsonReport); // JSON 리포트 생성: ${jsonFile.path} } catch (e) { // JSON 리포트 생성 실패: $e } // 실패한 테스트가 있으면 테스트 실패 // expect(results['failedTests'], equals(0), // reason: '${results['failedTests']}개의 테스트가 실패했습니다.'); }, timeout: Timeout(Duration(minutes: 10))); }); }