How do I unit test the methods in a method object?

Posted by Sancho on Stack Overflow See other posts from Stack Overflow or by Sancho
Published on 2010-05-06T21:10:50Z Indexed on 2010/05/06 21:18 UTC
Read the original article Hit count: 210

Filed under:
|
|
|

I've performed the "Replace Method with Method Object" refactoring described by Beck.

Now, I have a class with a "run()" method and a bunch of member functions that decompose the computation into smaller units. How do I test those member functions?

My first idea is that my unit tests be basically copies of the "run()" method (with different initializations), but with assertions between each call to the member functions to check the state of the computation.

(I'm using Python and the unittest module.)

© Stack Overflow or respective owner

Related posts about unit-testing

Related posts about unittest