Loading ...
Sorry, an error occurred while loading the content.

Re: [XP] Mocking Challenge: Article in DDJ

Expand Messages
  • Brian Slesinsky
    ... Maybe the analysis could be done over the entire test suite? If there are two unit tests in the suite that lock objects in the opposite order, then there
    Message 1 of 27 , Dec 22, 2005
    • 0 Attachment
      On 12/19/05, Tim Haughton <timhaughton@...> wrote:

      > Seems to me that the narrower the scope of the test, the smaller the
      > chance of creating a loop in the mutex graph. This would of course
      > depend on the nature of the system, but it seems that larger scale
      > tests, such as acceptance tests, or even run time diagnostics would be
      > the place to use this kind of technology.

      Maybe the analysis could be done over the entire test suite? If there
      are two unit tests in the suite that lock objects in the opposite
      order, then there might be a deadlock.

      If it worked, the nice thing about it would be that we don't even need
      to write any multithreaded tests or run on a multiprocessor system to
      detect potential deadlocks. It would suffice if each path through the
      program actually happens at some time during the test suite. (And
      perhaps paths from different unit tests could be stitched together to
      compute longer potential paths through the program.)

      The tricky part would be to figure out a useful definition of "might
      be the same object" for a test suite, especially in the presence of
      mocks. A conservative approach would be to assume that all
      implementations of the same interface could be the same object, but
      maybe that results in too many false positives. The analyzer might
      need to understand factory methods and assume that objects could be
      the same if they came from the same factory.

      It sounds difficult and of uncertain payoff, but not impossible.

      - Brian
    Your message has been successfully submitted and would be delivered to recipients shortly.