Question
· Feb 28, 2016

Mocking tools for Unit Testing

Hello everyone!

Does anyone know of a library that can be used to create Mock objects for Objectscript classes?

Right now, my team has been building mock objects by hand to help circumvent dependencies when writing and executing unit tests, but I always wondered if someone had ever created a Mock library like Mockito to help quicken the process. 

Thanks!

Discussion (4)0
Log in or sign up to continue

At the moment we mock pretty infrequently. We're doing so manually by subclassing and overriding the method implementation. I imagine you could create a generic mock object for any method with nice syntax sugar using the Dynamic Dispatch methods.

One of the showstoppers we have with mocking in objectscript is that it is not global - ie. we can't mock classes called by the implementation (without doing some sort of dependency injection) and there's no way at all to mock calls into routines. Anyone have any thoughts on overcoming these limitations?