perl-Test-Magpie - Mocking framework with method stubs and behaviour verification

Edit Package perl-Test-Magpie
https://metacpan.org/release/Test-Magpie/

Test::Magpie is a test double framework heavily inspired by the Mockito framework for Java, and also the Python-Mockito project. In Mockito, you "spy" on objects for their behaviour, rather than being upfront about what should happen. I find this approach to be significantly more flexible and easier to work with than mocking systems like EasyMock, so I created a Perl implementation. * Mock objects Mock objects, represented by the Test::Magpie::Mock manpage objects, are objects that pretend to be everything you could ever want them to be. A mock object can have any method called on it, does every roles, and isa subclass of any superclass. This allows you to easily throw a mock object around it will be treated as though it was a real object. * Method stubbing Any method can be called on a mock object, and it will be logged as an invocation. By default, method calls return 'undef' in scalar context or an empty list in list context. Often, though, clients will be interested in the result of calling a method with some arguments. So you may specify how a method stub should respond when it is called. * Verify interactions After calling your concrete code (the code under test) you may want to check that the code did operate correctly on the mock. To do this, you can use verifications to make sure code was called, with correct parameters and the correct amount of times. * Argument matching Magpie gives you some helpful methods to validate arguments passed in to calls. You can check equality between arguments, or consume a general type of argument, or consume multiple arguments. See the Test::Magpie::ArgumentMatcher manpage for the juicy details.

Refresh
Refresh
Source Files
Filename Size Changed
Test-Magpie-0.11.tar.gz 0000025466 24.9 KB
perl-Test-Magpie.changes 0000000332 332 Bytes
perl-Test-Magpie.spec 0000004302 4.2 KB
Latest Revision
Dominique Leuenberger's avatar Dominique Leuenberger (dimstar_suse) accepted request 851269 from Frank Schreiner's avatar Frank Schreiner (M0ses) (revision 3)
initialized devel package after accepting 851269
Comments 0
openSUSE Build Service is sponsored by