Blog: Can You Test a Clock in a Sealed Box?

A while ago, James Bach and I did a transpection session. The object of the conversation was to think critically about the common trope that every test consists of at least an input and an expected result. We wanted to go deeper than that, and in the process we discovered a number of useful ideas. A test can be informed by an expectation, but oracles can also be developed on the fly. Oracles can also be applied retrospectively, after the test has been “completed”, such that you never know when a test ends. James has a wonderful example of that here. We also came up with the notion of implicit and explicit inputs, and symbolic and non-symbolic inputs.

As the basis of our chat, James presented the thought experiment of testing a clock that you can’t get at. Just recently my friend Adam White pointed me to this little gem. Enjoy!

Want to know more? Learn about upcoming Rapid Software Testing classes here.

2 responses to “Can You Test a Clock in a Sealed Box?”

  1. Ray Oei says:

    I remember discussing this, and we mainly considered ‘light’ as a possible means of interacting with the clock in the box.

    I also realize that James’ statement in the transcript: “You can’t interact with the clock (except to look at it in normal light). Can the clock be tested?”, framed the case in such a way that it is an easy trap to stop thinking of other ways you might be able to interact.
    The statement could be wrong (intentionally)..

    This is brilliant 😉


  2. Jon Bach says:

    Ten things I want to know:
    1) How do you set it?
    2) If you ship it somewhere, will the vibrations in transit cause it to think it is being “knocked” and therefore constantly knock out the time? (A ticking package is not a wise thing to send.)
    3) When the alarm is set and then goes off, knock twice as it does so. Will it register the knocks as input to tell you the current time, or will it not accept input if it is too “busy”?
    4) Cover the photo-electric alarm interface and knock slowly (once every four seconds) – does it accept the cadence?
    5) If it’s 6:52 and 30 seconds, will it report it as 6:45 or 7:00?
    6) When it’s 2:00 am on Daylight Savings day, what will it report?
    7) What happens if you want to know what time it is in a completely dark room? Won’t the photoelectric register 2 knocks as an alarm input of 2 minutes instead of telling you the time?
    8) Assuming it’s a 24-hour (military time) clock, at midnight, does it ring out 24 knocks or 0 (for 0-hour)?
    9) If you knock it while the alarm is set (and hasn’t yet gone off), will it knock out the time?
    10) What is the threshold for setting an alarm? 60 knocks for 60 minutes from now? (If I want it to wake me up in 9 hours, I won’t be able to sleep because of how sore my knuckles will have been from 540 knocks.)

    Michael replies: Yes. And, as James says in a private message, “Don’t try it til you’ve knocked it.”

Leave a Reply

Your email address will not be published.