in reply to Re: Testing objects that cache
in thread Testing objects that cache
The first thing you probably want to test is that the cached object and the non-cached object in fact do have the same "black box" behavior.No, not really. Once the OP is that far, his problem is solved.
His problem is "how do I test whether caching was used"? If you don't know an object you have is a cached object or not, any test that compares it against an object that isn't cached is moot (as both object may not be cached).
Does caching really improve things?I don't think that "reconsider using X" is a very useful answer to "how do I test X happened".
For the consumer of a business object API, caching is just another way of implementing the same API. However, if your caching is implemented as a service to be used by many objects, then those who use it will see the caching behavior itself as the boundary of the black box. They may not care whether you use arrays or hashes to implement it, but they will care that the promised algorithm does what you claim it does. For example, if you have an algorithm that says that cache members should be polled for last use timestamp each time an object is fetched, then you can test for compliance with that specific contract.I've read the above paragraph a couple of times. I still have no clue whether you're trying to make a point, or whether you're just stringing words together.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Testing objects that cache
by ELISHEVA (Prior) on May 15, 2009 at 15:46 UTC |