Version 4 (modified by Xiaochen Pan, on Jul 7, 2012 at 2:46:15 AM) (diff)


TestDept? is unit testing framework providing stubing capabilities.

+ TestDept? support the xUnit architecture with stubbing functionality.

  • Stub functions are similar but different concept than mocking functions. It is supported by the replace_function(functions_to_be_replace, stub_function) interface. Mocking functions can deal with the argument expectations and mocked return values for any number of times you want. While stubing functions can only provide a uni-interface. For example, you can decide that a mocking function mock_function() to return 1 at the first time of being callled and return 2 at the second time of being called. When stub technique is used, you cannot expect the same function to return different values unless you provide the inside logic basing on inputs of arguments, which is time-consuming and inconvenient for test automation. And also, because of the uni-interface of the stubbing function, it cannot specify the different expected value for certain argument each time the stubbing function is called.

In conclusion, stubing functions are not as flexible and useful as mocking functions.