# Angular 단위 테스트 (Angular) > Jasmine, Karma, TestBed, 컴포넌트 테스트, 서비스 테스트, 모킹, 스파이, 비동기 테스트, fixture - 22 면접 질문 - Mid-Level - [면접 질문: Angular](https://sharpskill.dev/ko/technologies/angular/interview-questions.md) ## 1. Angular 단위 테스트에서 TestBed의 주요 역할은 무엇입니까? **답변** TestBed는 Angular 테스팅 모듈을 구성하고 생성하기 위한 주요 유틸리티입니다. providers, imports, declarations를 구성하고 격리된 테스트 환경에서 컴포넌트를 인스턴스화할 수 있습니다. TestBed는 Angular NgModule의 작동 방식을 시뮬레이션하는 테스트 컨텍스트를 생성하여 의존성 주입 및 컴포넌트 컴파일을 가능하게 합니다. ## 2. 서비스 인스턴스를 가져오려면 어떤 TestBed 메서드를 사용해야 합니까? **답변** TestBed.inject()는 테스팅 모듈 인젝터에서 서비스 인스턴스를 가져오기 위한 권장 메서드입니다. 이 메서드는 이전의 TestBed.get() 구문(deprecated)을 대체하며 더 나은 TypeScript 타이핑을 제공합니다. configureTestingModule을 통해 TestBed 구성에 제공된 서비스에 접근합니다. ## 3. TestBed.createComponent() 메서드는 무엇을 반환합니까? **답변** createComponent()는 ComponentFixture를 반환하며, 이는 컴포넌트 주위의 래퍼로 컴포넌트 인스턴스(componentInstance), DOM 요소(nativeElement), DebugElement 및 detectChanges()와 같은 테스트 메서드에 대한 접근을 제공합니다. ComponentFixture는 Angular 컴포넌트를 테스트하기 위한 중심 객체입니다. ## 19개 추가 질문 이용 가능 - 컴포넌트 테스트에서 fixture.detectChanges()의 역할은 무엇입니까? - 서비스 메서드를 모킹하기 위한 Jasmine 스파이를 어떻게 생성합니까? 무료로 가입하기: https://sharpskill.dev/ko/login ## 기타 Angular 면접 주제 - [TypeScript 기초](https://sharpskill.dev/ko/technologies/angular/interview-questions/typescript-basics.md): 25개 질문, Junior - [TypeScript 고급](https://sharpskill.dev/ko/technologies/angular/interview-questions/typescript-advanced.md): 20개 질문, Junior - [Angular 기초](https://sharpskill.dev/ko/technologies/angular/interview-questions/angular-fundamentals.md): 20개 질문, Junior - [컴포넌트와 라이프사이클](https://sharpskill.dev/ko/technologies/angular/interview-questions/components-lifecycle.md): 20개 질문, Junior - [Services & Dependency Injection](https://sharpskill.dev/ko/technologies/angular/interview-questions/services-dependency-injection.md): 20개 질문, Junior - [Angular 모듈 구성](https://sharpskill.dev/ko/technologies/angular/interview-questions/modules-organization.md): 22개 질문, Mid-Level - [Angular CLI](https://sharpskill.dev/ko/technologies/angular/interview-questions/angular-cli.md): 18개 질문, Junior - [디렉티브와 Pipe](https://sharpskill.dev/ko/technologies/angular/interview-questions/directives-pipes.md): 22개 질문, Mid-Level - [라우팅과 내비게이션](https://sharpskill.dev/ko/technologies/angular/interview-questions/routing-navigation.md): 24개 질문, Mid-Level - [리액티브 폼](https://sharpskill.dev/ko/technologies/angular/interview-questions/forms-reactive.md): 26개 질문, Mid-Level - [템플릿 기반 폼](https://sharpskill.dev/ko/technologies/angular/interview-questions/forms-template-driven.md): 16개 질문, Mid-Level - [RxJS 기초](https://sharpskill.dev/ko/technologies/angular/interview-questions/rxjs-fundamentals.md): 22개 질문, Mid-Level - [RxJS 연산자](https://sharpskill.dev/ko/technologies/angular/interview-questions/rxjs-operators.md): 24개 질문, Mid-Level - [HttpClient 및 API 호출](https://sharpskill.dev/ko/technologies/angular/interview-questions/http-client.md): 22개 질문, Mid-Level - [기본 상태 관리](https://sharpskill.dev/ko/technologies/angular/interview-questions/state-management-basics.md): 20개 질문, Mid-Level - [Change Detection](https://sharpskill.dev/ko/technologies/angular/interview-questions/change-detection.md): 20개 질문, Mid-Level - [Angular Signals](https://sharpskill.dev/ko/technologies/angular/interview-questions/angular-signals.md): 20개 질문, Mid-Level - [Standalone Components](https://sharpskill.dev/ko/technologies/angular/interview-questions/standalone-components.md): 18개 질문, Mid-Level - [엔드투엔드 테스팅](https://sharpskill.dev/ko/technologies/angular/interview-questions/testing-e2e.md): 18개 질문, Mid-Level - [빌드 및 최적화](https://sharpskill.dev/ko/technologies/angular/interview-questions/build-optimization.md): 20개 질문, Mid-Level - [NgRx 기초](https://sharpskill.dev/ko/technologies/angular/interview-questions/ngrx-fundamentals.md): 24개 질문, Senior - [NgRx 고급](https://sharpskill.dev/ko/technologies/angular/interview-questions/ngrx-advanced.md): 24개 질문, Senior - [Angular 아키텍처](https://sharpskill.dev/ko/technologies/angular/interview-questions/angular-architecture.md): 22개 질문, Senior - [성능 최적화](https://sharpskill.dev/ko/technologies/angular/interview-questions/performance-optimization.md): 22개 질문, Senior - [보안 및 모범 사례](https://sharpskill.dev/ko/technologies/angular/interview-questions/security-best-practices.md): 20개 질문, Senior - [고급 RxJS 패턴](https://sharpskill.dev/ko/technologies/angular/interview-questions/advanced-rxjs-patterns.md): 22개 질문, Senior - [Angular Universal 및 SSR](https://sharpskill.dev/ko/technologies/angular/interview-questions/angular-universal-ssr.md): 20개 질문, Senior - [Angular 마이크로 프론트엔드](https://sharpskill.dev/ko/technologies/angular/interview-questions/micro-frontends-angular.md): 20개 질문, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/ko/technologies/angular/interview-questions/testing-unit