|Welcome to the Monastery|
Testing objects that cacheby dreadpiratepeter (Priest)
|on May 15, 2009 at 13:18 UTC||Need Help??|
dreadpiratepeter has asked for the
wisdom of the Perl Monks concerning the following question:
I am trying to write tests for an object that uses a cache.
The issue that I am running into is this. Normally, I write all my tests from outside the object, ie. my tests treat the object as a black-box and I only use the api for tests.
This shields me from changes in my object implementation causing changes in my tests, and validates that changes don't break the api, blah blah blah - standard testing stuff.
But, this object implements a cache internally, but from the outside there is no way of knowing if the cache was used or not.
What is the best way of testing the caching behavior?
How do the wise test caching behavior?
"Worry is like a rocking chair. It gives you something to do, but it doesn't get you anywhere."