What should I test? When should I test?

I love test driven development but I don't always use it. You might wonder why, well the answer is simple - time constraints. If you have a major feature to work on, and are given too short a time to deliver, what would you do? Spend half the time writing tests or have faith that the steps you have always taken to produce working software will work this time around too? I often choose the later, so I end up using half the time to build out the features and the remaining time debug and deal with additional requirements that were not so apparent when the project began.

But if you have the luxury of time or are dealing with a client who understands the importance of testing and is willing to accommodate that. What should you test?

Test every class you create, your tests should verify that the methods or functions in every class actually execute; that they give the expected response to the various input types including null; that it handles bad input, that your app does not crash because of an exception; that links/buttons post to or request the expected page. You can even test that the expected information exists on a page. To be continued

Image by PublicDomainPictures from Pixabay