in reply to Passing data between modules using Test::Class

I'd be much more tempted to use a mock object for A when testing B. The mock object does nothing except provide the output you want for B.

Why is this useful? If you're only testing B with good output from A, what happens when B gets bad input? You haven't tested that if you're dependent on the real A providing data; you've only tested the "got good data" paths. Depending on the complexity of A's output and B's processing, this could leave a lot of code untested.

Since this has to do with actual money (and possible losses thereof) I'd want to make sure I had tested all the code paths.

  • Comment on Re: Passing data between modules using Test::Class

Replies are listed 'Best First'.
Re^2: Passing data between modules using Test::Class
by arc_of_descent (Hermit) on Dec 15, 2006 at 09:17 UTC

    I don't really care if module B gets bad input from module A, as that is most likely taken care of as a generic input error. But I do care about the correct values returned after I invoke Service A, which I then need to send to Service B. Service B can only be invoked after I get some values from Service A.

    Mocking Service A sounds like a good idea, and I may look further into this, provided the sandbox returns the same results everytime


    --
    Rohan