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.

In reply to Re^2: Testing objects that cache by JavaFan
in thread Testing objects that cache by dreadpiratepeter

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.