The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


Test::Mock::Test - Mock Test::* code to succeed or do nothing.


This module mocks typical test function from modules


to always return ok. In particular this means their test functionality is skipped, so the overhead of the tests is dropped and reduced to only the function call overhead.

You can use this, for instance, to reuse test scripts as benchmarks where the overhead of the test code stands in the way of measuring the actual code runtime. The ratio of that overhead, however, depends on the test script, e.g. tests around Test::Deep with big data structures bring them in.


The module executes mocking during load so you can activate the module from the outside, like this:

  perl -MTest::Mock::Test t/sometest.t

If you even want to avoid the overhead of the underlying Test::Builder::ok() calls you can skip them this way:

  perl -MTest::Mock::Test=no_test_builder t/sometest.t


Steffen Schwigon, <schwigon at>


Please report any bugs or feature requests to bug-test-mock-test at, or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


You can find documentation for this module with the perldoc command.

    perldoc Test::Mock::Test

You can also look for information at:


Copyright 2010-2011 Steffen Schwigon, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.