Test Driven Development Flashcards

1
Q

How is the test-driven development process?

A

Begins with writing a test before any functional code, emphasizing a repeatable cycle of specific steps to enhance software development and design.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why is TDD important?

A

It ensures the existence of tests, enhancing software quality from the start. It also prevents the skipping of the test phase and protects the testing phase from being overlooked or undervalued by management pressures.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the goal of TDD?

A

To ensure software quality.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are some common challenges for TDD?

A

Encountering professionals who undervalue it and the risk of writing ineffective tests.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are some of the advantages of Test-Driven Development?

A
  • Ensure Code Quality
  • Clarifies Requirements Before Coding
  • Facilitates Team Communication
  • Prevents Code Rot
  • Improves Code Structure and Organization
  • Safeguards Against Regression
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the disadvantages of Test-Driven Development?

A
  • Increased Initial Time Investment
  • Challenges in Gaining Management Buy-In
  • Risk of Writing Ineffective Tests
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the three main steps of Test-Driven Development?

A
  • A failing test
  • Write just enough production code to pass the test
  • Refactor the code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the purpose of Step 1?

A

STEP 1: WRITE A FAILING TEST

Forces developers to clearly define the functionality they intend to implement before writing any production code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the purpose of Step 2?

A

STEP 2: WRITE PRODUCTION CODE TO PASS THE TEST

Only enough code is written to make the test pass (changing the test status from red to
green). This approach ensures that no untested or excess code is added, minimizing the risk of bugs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the purpose of Step 3?

A

STEP 3: REFACTOR THE CODE

Once the test passes, the next task is to improve the written code by making it more efficient, clean, or readable.

This step enhances the code’s modularity and maintainability without compromising the functionality confirmed by the test.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is Red, Green, Refactor?

A

The iterative process for TDD’s steps is termed “Red, Green, Refactor,” symbolizing the stages
of test failure, passing the test, and
code improvement, respectively.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is RITE?

A

Readable, Isolated, Thorough, Explicit.

They are principles for writing effective tests.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly