test: 통합 테스트 오류 및 경고 수정
- 모든 서비스 메서드 시그니처를 실제 구현에 맞게 수정 - TestDataGenerator 제거하고 직접 객체 생성으로 변경 - 모델 필드명 및 타입 불일치 수정 - 불필요한 Either 패턴 사용 제거 - null safety 관련 이슈 해결 수정된 파일: - test/integration/screens/company_integration_test.dart - test/integration/screens/equipment_integration_test.dart - test/integration/screens/user_integration_test.dart - test/integration/screens/login_integration_test.dart
This commit is contained in:
107
test/integration/automated/run_equipment_out_test.dart
Normal file
107
test/integration/automated/run_equipment_out_test.dart
Normal file
@@ -0,0 +1,107 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import '../real_api/test_helper.dart';
|
||||
import 'screens/equipment/equipment_out_screen_test.dart';
|
||||
import 'framework/infrastructure/test_context.dart';
|
||||
import 'framework/infrastructure/report_collector.dart';
|
||||
import 'framework/core/api_error_diagnostics.dart';
|
||||
import 'framework/core/auto_fixer.dart' as auto_fixer;
|
||||
import 'framework/core/test_data_generator.dart';
|
||||
|
||||
void main() {
|
||||
late GetIt getIt;
|
||||
late EquipmentOutScreenTest equipmentOutTest;
|
||||
|
||||
group('Equipment Out Automated Test', () {
|
||||
setUpAll(() async {
|
||||
// 테스트 환경 설정
|
||||
await RealApiTestHelper.setupTestEnvironment();
|
||||
try {
|
||||
await RealApiTestHelper.loginAndGetToken();
|
||||
print('로그인 성공, 토큰 획득');
|
||||
} catch (error) {
|
||||
throw Exception('로그인 실패: $error');
|
||||
}
|
||||
|
||||
getIt = GetIt.instance;
|
||||
|
||||
// 테스트 프레임워크 구성 요소 초기화
|
||||
final testContext = TestContext();
|
||||
final reportCollector = ReportCollector();
|
||||
final errorDiagnostics = ApiErrorDiagnostics();
|
||||
final autoFixer = auto_fixer.ApiAutoFixer(diagnostics: errorDiagnostics);
|
||||
final dataGenerator = TestDataGenerator();
|
||||
|
||||
// Equipment Out 테스트 인스턴스 생성
|
||||
equipmentOutTest = EquipmentOutScreenTest(
|
||||
apiClient: getIt.get(),
|
||||
getIt: getIt,
|
||||
testContext: testContext,
|
||||
errorDiagnostics: errorDiagnostics,
|
||||
autoFixer: autoFixer,
|
||||
dataGenerator: dataGenerator,
|
||||
reportCollector: reportCollector,
|
||||
);
|
||||
});
|
||||
|
||||
tearDownAll(() async {
|
||||
await RealApiTestHelper.teardownTestEnvironment();
|
||||
});
|
||||
|
||||
test('Equipment Out 화면 자동화 테스트 실행', () async {
|
||||
print('\n=== Equipment Out 화면 자동화 테스트 시작 ===\n');
|
||||
|
||||
// 메타데이터 가져오기
|
||||
final metadata = equipmentOutTest.getScreenMetadata();
|
||||
print('화면: ${metadata.screenName}');
|
||||
print('엔드포인트 수: ${metadata.relatedEndpoints.length}');
|
||||
|
||||
// 기능 감지
|
||||
final features = await equipmentOutTest.detectFeatures(metadata);
|
||||
print('감지된 기능: ${features.length}개');
|
||||
|
||||
// 테스트 실행
|
||||
final result = await equipmentOutTest.executeTests(features);
|
||||
|
||||
// 결과 출력
|
||||
print('\n=== 테스트 결과 ===');
|
||||
print('전체 테스트: ${result.totalTests}개');
|
||||
print('성공: ${result.passedTests}개');
|
||||
print('실패: ${result.failedTests}개');
|
||||
print('건너뜀: ${result.skippedTests}개');
|
||||
// 소요 시간은 reportCollector에서 계산됨
|
||||
print('소요 시간: 측정 완료');
|
||||
|
||||
// 리포트 생성
|
||||
final reportCollector = equipmentOutTest.reportCollector;
|
||||
|
||||
// HTML 리포트
|
||||
final htmlReport = await reportCollector.generateHtmlReport();
|
||||
await reportCollector.saveReport(
|
||||
htmlReport,
|
||||
'test_reports/html/equipment_out_test_report.html',
|
||||
);
|
||||
|
||||
// Markdown 리포트
|
||||
final markdownReport = await reportCollector.generateMarkdownReport();
|
||||
await reportCollector.saveReport(
|
||||
markdownReport,
|
||||
'test_reports/markdown/equipment_out_test_report.md',
|
||||
);
|
||||
|
||||
// JSON 리포트
|
||||
final jsonReport = await reportCollector.generateJsonReport();
|
||||
await reportCollector.saveReport(
|
||||
jsonReport,
|
||||
'test_reports/json/equipment_out_test_report.json',
|
||||
);
|
||||
|
||||
print('\n리포트가 test_reports 디렉토리에 저장되었습니다.');
|
||||
|
||||
// 테스트 실패 시 예외 발생
|
||||
if (result.failedTests > 0) {
|
||||
fail('${result.failedTests}개의 테스트가 실패했습니다.');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user