I'm not brand new to the concept of unit testing but at the same time I've not yet mastered them either.
The one question that has been going through my head recently as I've been writing unit tests while writing my code using the TDD methodology is: to what level should I be testing?
Sometimes I wonder if I'm being excessive in the use of unit testing.
At what point should a developer stop writing unit tests and get actual work done?
I might need to clarify that question before people assume I'm against using TDD...
What I'm struggling with is the granularity of my test....
- When my app has a config file do I test that values can be retrieved from the file? I lean towards yes....but....
- Do I then write a unit test for each possible config value that will be present? ie check that they exist...and can be parsed to the correct type...
- When my app writes errors to a log do I need to test that it is able to write to the log? Do I then need to write tests to verify that entries are actually made to the log?
I want to be able to use my unit tests to verify the behavior of my app...but I'm not quite sure where to stop. Is it possible to write tests that are too trivial?