Test::MockObject - Perl extension for emulating troublesome interfaces
use Test::MockObject; my $mock = Test::MockObject->new(); $mock->set_true( 'somemethod' ); ok( $mock->somemethod() ); $mock->set_true( 'veritas') ->set_false( 'ficta' ) ->set_series( 'amicae', 'Sunny', 'Kylie', 'Bella' );
It's a simple program that doesn't use any other modules, and those are easy to test. More often, testing a program completely means faking up input to another module, trying to coax the right output from something you're not supposed to be testing anyway.
Testing is a lot easier when you can control the entire environment. With Test::MockObject, you can get a lot closer.
Test::MockObject allows you to create objects that conform to particular interfaces with very little code. You don't have to reimplement the behavior, just the input and the output.
The full documentation for this module can be found at CPAN Search, MetaCPAN, or by running perldoc Test::MockObject at the commandline.
perldoc Test::MockObject
chromatic, <chromatic at wgz dot org>
perl, Test::Tutorial, Test::More, http://www.perl.com/pub/a/2001/12/04/testing.html, and http://www.perl.com/pub/a/2002/07/10/tmo.html.
Copyright (c) 2002 - 2015 by chromatic <chromatic at wgz dot org>.
This program is free software; you can use, modify, and redistribute it under the same terms as Perl 5.10.x itself.
See http://www.perl.com/perl/misc/Artistic.html
To install Test::MockObject, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::MockObject
CPAN shell
perl -MCPAN -e shell install Test::MockObject
For more information on module installation, please visit the detailed CPAN module installation guide.