'How to test?' is a question that connot be answered in general. 'When to test?' however, does have a general answer: as early and as often as possible.
More from Bjarne Stroustrup
A program that has not been tested does not work.
Permalink to quote #4 An organisation that treats its programmers as morons will soon have programmers that are willing and able to act like morons only.
Permalink to quote #6 Design and programming are human activities; forget that and all is lost.
Permalink to quote #3