Loading

Quipoin Menu

Learn • Practice • Grow

spring / Integration Testing in Spring Boot
mcq
Direction: Choose the correct option

Q1.

What is integration testing?
A. Testing multiple units together to verify they work correctly
B. Testing a single unit
C. Testing UI
D. None
Direction: Choose the correct option

Q2.

Which annotation is commonly used for integration tests in Spring Boot?
A. @SpringBootTest
B. @IntegrationTest
C. @Test
D. @RunWith
Direction: Choose the correct option

Q3.

What is @AutoConfigureMockMvc used for?
A. To configure MockMvc for testing web layer
B. To auto-configure MVC
C. To mock MVC
D. None
Direction: Choose the correct option

Q4.

What does @TestEntityManager do?
A. Provides a JPA EntityManager for testing
B. A test entity
C. A mock EntityManager
D. None
Direction: Choose the correct option

Q5.

How do you test a REST endpoint with MockMvc?
A. mockMvc.perform(get('/api/users')).andExpect(status().isOk())
B. using RestTemplate
C. using WebClient
D. All
Direction: Choose the correct option

Q6.

What is the purpose of @Sql annotation?
A. To execute SQL scripts before or after a test
B. To query database
C. To define schema
D. None
Direction: Choose the correct option

Q7.

How do you test database interactions with Spring Boot?
A. @DataJpaTest for JPA slice tests
B. @JdbcTest for JDBC
C. Both A and B
D. None
Direction: Choose the correct option

Q8.

What is a test database often used in integration tests?
A. H2 in-memory database
B. MySQL
C. PostgreSQL
D. Oracle
Direction: Choose the correct option

Q9.

How do you roll back transactions after a test?
A. @Transactional on test method rolls back by default
B. @Rollback
C. Both A and B
D. None
Direction: Choose the correct option

Q10.

What is @TestConfiguration used for?
A. To define additional beans or override for tests
B. To configure tests
C. To replace main configuration
D. None