|
I have a singleton data cache I'm working with.
I was testing whether or not the cache items were removing correctly from a consumer of the data.
I was checking via a different object in the debugger that would pull the object in question from the cache.
The problem: This different object creates the bloody cache item if it doesn't exist, but in the debugger it just looked like it wasn't deleting. My code was fine all along... The brain fart was in the debugging... Double
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
Been there! Logging/tracing would have given you insight a bit quicker.
Wout
|
|
|
|
|
I was trying to save some time in the testing as a failure would have been really obvious to spot in test.
Figure that... You'd think I would know better after how many years of doing this.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
That's what unit tests are for, surely?
Debugger based testing is fundamentally limited by the lack of repeatability intrinsic in having a human poking around during the session, whereas automated tests to do the same thing should (if designed correctly) be absolutely repeatable.
As a bonus the tests stick around long after the debug session is ancient history. If someone breaks the code several years from now, the tests will start failing to alert you to that fact.
Anna
Tech Blog | Visual Lint
"Why would anyone prefer to wield a weapon that takes both hands at once, when they could use a lighter (and obviously superior) weapon that allows you to wield multiple ones at a time, and thus supports multi-paradigm carnage?"
|
|
|
|
|
When I first started in a Microsoft position, I asked why they were renaming procedures that were basically doing the same thing. It was their control method, the old procedures retained old behavior, the new code expected new behavior. After the new was promoted to production, the old was removed from SQL. If the lab started squaking, they knew they missed something.
Sure missed that on a later project. About 80% of the existing tests were failing because the sprocs were massively changed and no-one bothered to maintain the tests when they re-wrote the sprocs.
|
|
|
|