1.
Refactoring is not one of the stages of TDD.
Correct Answer
B. False
Explanation
Refactoring is indeed one of the stages of TDD. TDD, or Test-Driven Development, follows a cycle of three stages: writing a failing test, writing the minimal code to pass the test, and then refactoring the code to improve its design without changing its functionality. Refactoring helps to ensure clean and maintainable code by eliminating duplication, improving readability, and enhancing overall code quality.
2.
TDD required a developer to write the test cases before writing the actual production code.
Correct Answer
A. True
Explanation
TDD stands for Test-Driven Development, which is a software development approach that emphasizes writing tests before writing the actual code. This approach helps in ensuring that the code meets the desired requirements and is functioning correctly. By writing the test cases first, developers can have a clear understanding of what needs to be implemented and can design the code accordingly. It also helps in identifying any potential issues or bugs early in the development process. Therefore, the statement "TDD required a developer to write the test cases before writing the actual production code" is true.
3.
TDD is basically unit testing.
Correct Answer
B. False
Explanation
TDD, or Test-Driven Development, is not just unit testing. While unit testing is a part of TDD, it is not the sole focus. TDD is a software development approach where tests are written before the code is implemented. It involves a cycle of writing a failing test, writing the code to pass the test, and then refactoring the code. TDD encompasses not only unit tests but also integration tests and acceptance tests, ensuring that the software meets the desired requirements. Therefore, the statement that TDD is basically unit testing is false.
4.
TDD can help a developer improve his initial design of a method by forcing him to come up with situations in which the test case can fail
Correct Answer
A. True
Explanation
TDD, or Test-Driven Development, is a software development approach where tests are written before the actual code. By following this approach, a developer is forced to think about potential situations in which the test case can fail. This helps in identifying potential flaws or weaknesses in the initial design of the method. By addressing these situations and making necessary improvements, the developer can enhance the overall quality and effectiveness of the method. Therefore, the statement that TDD can help a developer improve his initial design of a method by forcing him to come up with situations in which the test case can fail is true.
5.
TDD doesnot help in detection of bugs at an early developmental stages of SDLC.
Correct Answer
B. False
Explanation
TDD, or Test-Driven Development, is a software development approach that focuses on writing tests before writing the actual code. By following TDD, developers can identify and fix bugs at an early stage of the Software Development Life Cycle (SDLC). This is because the tests are designed to check the functionality of the code, and any bugs or errors can be detected and resolved during the testing phase. Therefore, the statement that TDD does not help in the detection of bugs at an early developmental stage of SDLC is false.
6.
There are _____ types of TDD.
Correct Answer
2, two
Explanation
In the context of Test Driven Development (TDD) in software engineering, there are generally considered to be two main types of TDD:
Classic TDD: Also known as "red-green-refactor" TDD, this approach involves writing a failing test first, then writing the code to make the test pass, and finally refactoring the code while keeping all tests passing.
Outside-In TDD: Also known as "mockist" TDD or "London" TDD, this approach starts with high-level acceptance tests and drives the development from the outside interfaces towards the internal implementation details.
These two types represent different strategies and philosophies within the practice of TDD.
7.
TDD has been discovered or reinvented by _________
Correct Answer
Kent Beck
Explanation
Kent Beck is credited with discovering or reinventing Test-Driven Development (TDD). TDD is a software development process that involves writing tests for a specific feature before writing the actual code. Beck introduced this concept in the late 1990s and popularized it through his book "Test-Driven Development: By Example." He emphasized the importance of writing tests first to drive the development process, improve code quality, and ensure that the software meets the desired requirements. Beck's contribution to TDD has had a significant impact on the software development industry, leading to its widespread adoption.
8.
TDD involves automating of test cases according to the need of the user
Correct Answer
A. True
Explanation
TDD, or Test-Driven Development, is a software development approach where test cases are written before the actual code is implemented. This ensures that the code meets the requirements and passes the tests. By automating the test cases, developers can continuously run them to check for any errors or bugs in the code. Therefore, the statement that TDD involves automating test cases according to the user's needs is true.
9.
Give an example of a situation where TDD will not work.(Hint: Think of situations where entire production code is required before starting the testing phase)
10.
ATDD is also called __________.
Correct Answer
Behavior Driven Development
Explanation
ATDD stands for Acceptance Test Driven Development, which is a software development methodology that involves creating acceptance tests before implementing the features. These acceptance tests define the desired behavior of the system from the perspective of the user. Behavior Driven Development (BDD) is a similar approach that focuses on defining the behavior of the system using a more business-readable language. Therefore, BDD is also referred to as ATDD, making it the correct answer.