Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Test::Able::Runner(3) User Contributed Perl DocumentationTest::Able::Runner(3)

NAME
       Test::Able::Runner - use	Test::Able without a bunch of boilerplate

VERSION
       version 1.001

SYNOPSIS
	 use Test::Able::Runner;

	 use_test_packages
	     -base_package => 'My::Project::Test';

	 run;

DESCRIPTION
       I like Test::Able. I really don't like having to	copy my	boilerplate
       test runner and modify it when I	use it in a new	project. This provides
       a basic test runner for your testable tests that	takes care of the
       basics for you. You can extend it a bit to customize things if you like
       as well.	Let me know if you want	this to	do something else.

       This mostly assumes that	you want to run	several	tests as a group
       within a	single Perl interpreter. If this is not	what you want, then
       you probably don't want this module.

METHODS
   use_test_packages
       The first thing your test runner	needs to do is call this method	to
       tell it what packages need to be	included in your test.

   COMMON CASES
       Before describing the options, here are some examples of	how to use
       this subroutine.

       EXAMPLE 1

	 use_test_packages
	     -base_package => 'My::Project::Test',
	     -test_path	   => 't/lib';

       This is pretty much the simplest	case. This will	load and run all the
       packages	starting with the name "My::Project::Test" found in the
       project's t/lib directory. I show the "-test_path" option here, but in
       this case it's redundant. Your test path	is assumed to be t/lib in the
       usual case.

       EXAMPLE 2

	 use_test_packages
	     -test_packages => [ qw(
		 My::Project::Test::One
		 My::Project::Test::Two
		 My::Project::Test::Three
	     ) ];

       Rather than searching for any test packages you might have in your test
       folder, you might prefer	to explicitly list them.

       OPTIONS

       "-base_package"
	   This	is the package namespace to search for classes within. Any
	   class found under this namespace (within any	directory included in
	   "-test_path") will be run in	your tests. If you want	to include
	   classes under this base package namespace that are not tests	(test
	   roles or base classes or whatever), you may place a global package
	   variable within the package named $NOT_A_TEST and set it to a true
	   value:

	     package My::Project::Test::Base;
	     use Test::Able;

	     our $NOT_A_TEST = 1;

	   You may use this option or the "-test_packages" option. This	may be
	   a single scalar package name

       "-test_packages"
	   This	is the list of test packages to	load and run. It is always
	   given as an array of	package	names.

       "-test_path"
	   This	is the search path for test classes. This lists	additional
	   paths that should be	added to @INC to search	for tests before
	   loading the tests. These paths are added to the front of @INC.

	   It can be given as a	single scalar or as an array of	paths:

	     use_test_packages
		 -base_package => 'My::Project::Test',
		 -test_path    => [ 't/online',	't/offline' ];

   init_meta
       Sets up your test runner	package.

   run
       This invokes the	test runner for	all the	tests you've requested.

COOKBOOK
       Here are	some other things you might like to try.

   Test	Runner Tests
       The test	runner itself may have tests if	you want. The test runner
       classes uses the	usual Test::Able bits, so this works. Similarly, you
       can do setup, teardown, and all the rest	in your	runner.

	 use Test::Able::Runner;

	 use_test_packages
	     -base_package => 'Foo::Test';

	 test plan => 1, test_something	=> sub {
	     ok(1);
	 };

	 run;

AUTHOR
       Andrew Sterling Hanenkamp "<hanenkamp@cpan.org>"

COPYRIGHT AND LICENSE
       Copyright 2010 Qubling Software LLC.

       This library is free software. You can redistribute it and/or modify it
       under the same terms as Perl itself.

perl v5.32.1			  2010-01-30		 Test::Able::Runner(3)

NAME | VERSION | SYNOPSIS | DESCRIPTION | METHODS | COOKBOOK | AUTHOR | COPYRIGHT AND LICENSE

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Test::Able::Runner&sektion=3&manpath=FreeBSD+13.0-RELEASE+and+Ports>

home | help