Question about TDD


#1

So I read the codecademy article about Test driven development (TDD), and I have a question: How do I Implement this when coding? This may seem like a dumb or simple question, but I’m wondering is there a software that I can use for TDD when I’m coding? Or do I have to make the process myself? Sorry if this is confusing.


#2

A program cannot know what the expectations are, so no, there is no software, per se. The programmer needs to write the test code since they have intimate knowledge of what the code is expected to return.

The general notion is to write code that at first returns expected values when the correct inputs are supplied. Then the effort is spent to break the code by throwing everything at it that is not a valid input.

Say for instance a function is expecting string inputs. What happens when booleans, numbers, lists, objects and other functions are tossed in, including empty strings. The testing should lead to a solution that prevents those inputs from throwing errors or raising exceptions.