wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Test Driven Development

Total questions: 14

Worksheet time: 7mins

Name
Class
Date
1.

What is the most basic type of developer level test?

a)

Integration Test

b)

Universal Test

c)

Unit Test

d)

Basic Test

2.

Which of the following does not help you write a unit test?

a)

JUnit

b)

Mockito

c)

Lombok

d)

PowerMock

3.

Which of the following is not a desirable quality of "a unit test"?

a)

Tests one property at one time

b)

Fast

c)

I/O or File Operations

d)

Covering a small portion of code

4.

What does @InjectMocks do?

a)

Create an instance of test class

b)

Create an instance of test class and inject any dependencies as Mocks

c)

Inject Mocks in already created objects

d)

None of the above

5.

Which of the following will help you identify unused dependencies in the code?

a)

Unit Testing

b)

Integration Testing

c)

Static Code analysis

d)

All of the above

6.

Which of the following is first stage of TDD?

a)

Write Code

b)

Write Test

c)

Refactor

d)

Execute Test

7.

What is the significance of writing a failing test?

a)

We should not. We should focus on writing a test that passes

b)

A failing test shows that some code change is required in our program. If it is not failing, no change required.

c)

A failing test shows that the previous developer didn't do a good job.

d)

A failing test gives you an opportunity to enhance code coverage

8.

What is a test?

a)

A measure to check if the code meets the defined specifications

b)

A measure to check if the code is visually beautiful

c)

A measure to check if the code contains security vulnerabilities?

d)

A measure to increase code coverage

9.

What's true about Mocking in a unit test?

a)

Making fun of a unit test.

b)

Mocking is a way of dependencies injection, without worrying about the behaviour

c)

Mocking allows us to change the behaviour of the class under test

d)

Mocking is discouraged in unit testing

10.

How can we create a dummy environment for testing REST Apis using SpringBoot?

a)

JUnit

b)

environment.properties

c)

MockServer

d)

MockMvc

11.

At what stage should I refactor my code as per TDD?

a)

Whenever you like

b)

After writing a failing test case

c)

At the time of writing a test case

d)

After the test case is green

12.

Which of the following is not a stage in TDD?

a)

Red

b)

Green

c)

Refactor

d)

Commit

13.

I need to test if I am able to access data from an API. What type of test am I going to write?

a)

Unit Test

b)

Mocked Unit Test

c)

Integration Test

d)

Functional test

14.

I need to test if a service method is fine or not. What type of test do I need to write?

a)

Unit Test

b)

Integration Test

c)

Selenium Test

d)

Black Box Test