First Law of TDD

5 minutes 5 Questions

The concept of 'First Law of TDD' suggests that you cannot write production code without first writing a failing test. In simple words, it means that the test should be written before any code. This serves as a blueprint and guides the development of the feature. Additionally, it ensures that the feature is only considered complete when it passes this test. It enforces discipline and is beneficial in maintaining a high standard of code quality throughout the development process.

Guide to First Law of TDD

The First Law of Test-Driven Development (TDD) is pivotal within the domain of software development, particularly for PMI-ACP students, as it forms the foundation of understanding TDD and implementing it efficiently.

It is derived from the principles of TDD and states 'You are not allowed to write any production code unless it is to make a failing unit test pass.'

This rule reinforces the essential practice of writing unit tests before the actual code. In turn, it assures that the code is bug-free, adequately meets the user requirements, and handles potential error scenarios.

How it Works: The process begins with a developer writing a failing test case that defines a desired improvement or new function. Next, they write the smallest amount of code to pass that test and finally, refactor the code to acceptable standards.

For your exam:
Exam Tips - Answering Questions on First Law of TDD: 1) Understand the definition clearly; 2)Know how the First Law works in a practical scenario; 3) Be prepared for questions on its application or scenarios in the software development process; 4) Remember, you can’t write code until you have a failing unit test, which you are then obliged to pass with the minimum amount of production code; 5) Lastly, practise answering typical questions that could come up in your exam for better preparation.
Test mode:

PMI-ACP - First Law of TDD Example Questions

Test your knowledge of First Law of TDD

Question 1

In an agile team, your project leader encourages best practices and wants to make sure TDD First Law is understood and being applied. Which scenario demonstrates the correct application of TDD First Law?

Question 2

You encountered a scenario in your project where the function does not meet the requirements. According to the First Law of TDD, how should you approach the situation?

Question 3

Your team made a group decision to follow TDD's paradigms. It's your first agile project and you aren't aware of the order of the development process. What is the correct order according to TDD's First Law?

More First Law of TDD questions
10 questions (total)