I want to move to the next level in testing all my code, and writing tests before I code. One thing that's stopping me is I see some very difficult situations to test. How do I test something graphical? For example, I have routines that are generating charts and graphs in PNG format. How do I test these? How would I test a GUI interface for something? Also, how do I test routines with side effects? (i.e., routine prints to the screen rather than or in addition to returning a value).
I understand that writing my tests first and designing with testing in mind will go a long way toward making my code testable. I also understand that experience will go a long way toward teaching me to test anything. But so far I still just can't foresee how to do some of these things (or the ways I can imagine to do it are impractical).
Any sources people could point me to about more complicated testing like this, books, urls, periodicals, or forums, would be immensely appreciated. I need to see what path people took when they came this way before.