In your journal entry for this week, answer these questions
- In your own words, what is TDD about?
- What is a MOCK (also called DOUBLE) and how does it help in unit testing?
TDD is a style of programming where you have coding, testing, and design that are tightly interwoven. In order to do this style of programming, you write unit test, run the test to fail, make code to make the test pass, refactor the code, and then repeat. This will create lots of unit tests for your project which will add more credibility and workingness to your codebase.
Mocking is just a way of isolating your code and testing it without having external dependencies. The dependencies in this care are replaced by objects that simulate the behavior of real ones. For this project we used a stub. A stub is an object that returns a specific result based on a specific set of inputs and wont respond to anything outside of the test.
In the past, I've used Mocks when making tests using NUnit. I used it to test methods to see how many times it was called etc.
No comments:
Post a Comment