Bird
0
0

In Angular testing, which method is used to configure the testing module with service providers?

easy📝 Conceptual Q2 of 15
Angular - Testing
In Angular testing, which method is used to configure the testing module with service providers?
ATestBed.createComponent
BTestBed.runModule
CTestBed.injectService
DTestBed.configureTestingModule
Step-by-Step Solution
Solution:
  1. Step 1: Recall Angular testing setup

    TestBed.configureTestingModule is the method to set up the testing environment including providers.
  2. Step 2: Confirm correct method for adding services

    Providers like services are added inside configureTestingModule to prepare for injection.
  3. Final Answer:

    TestBed.configureTestingModule -> Option D
  4. Quick Check:

    Setup method = B [OK]
Quick Trick: Use configureTestingModule to add providers in tests [OK]
Common Mistakes:
  • Using createComponent for service setup
  • Assuming injectService is a TestBed method
  • Confusing runModule with configuration

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes