In your own words, what is TDD about?
Test-Driven Development (TDD) is an approach to software development that uses the Agile process. It differs from traditional unit testing because the tests happen before the feature code is actually written. First, a failing test is created for an unimplemented feature. Next, the minimum code required to pass the test is written. Finally, the code is revised and improved (while still being tested along the way). This cycle repeats until all requirements are met.
What is a MOCK (also called DOUBLE) and how does it help in unit testing?
In unit testing, mocks are special objects that are used to imitate the behavior of a real object in our code. Sometimes it is not practical to use real objects for testing, like when there are external dependencies. A mock object does not depend on the state of any external objects and can return specific results based on predetermined inputs. A mock object is only useful for its associated unit test. Using mocks helps the unit testing process by allowing developers to write more concise unit tests.
No comments:
Post a Comment