Andrew F. Hampe > Wetware-Test-CreateTestSuite-0.03 > create_testsuite

Download:
Wetware-Test-CreateTestSuite-0.03.tar.gz

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Source  

NAME ^

create_testsuite - creates TestSuite.pm files

SYNOPSIS ^

  create_testsuite [ -verbose | -help | -pod ]
  [ -preview ] [ some_path ]

DESCRIPTION ^

The intention is to create a Foo::TestSuite for all Foo modules that are found.

If no other arguments are created, then create_testsuite assumes that the modules are to be found in './lib' - assuming that one is running it at the top of a new distribution.

Or a distribution that needs to be updated.

CHANGE STOCK test files ^

There are two semi standard .t test scripts that need to be changed to work and play well with the TestSuite approach, since if one attempts to do the simple Test::Compile of any Module that inherits from a Test::Class based module with the INIT block, they will fail becaue 'it is too late for INIT' - this is also true of Pod Coverage.

So the fix is to call a sub.

Modify pod-coverage.t to use:

 all_non_testsuite_pod();

 #-------------------------------------------------------------

 sub all_non_testsuite_pod {

        my @modules = grep { $_ !~ m{::TestSuite$} } all_modules();
        plan tests => scalar @modules;
        foreach my $module ( @modules ) {
                pod_coverage_ok($module);
        }
        return;
 }

And it will filter out the modules *::TestSuite.

The compile_pm script is about the same, except that it runs with module file names:

 all_non_testsuite_modules();

 #----------------------------------------------------------------

 sub all_non_testsuite_modules {

        my @modules = grep { $_ !~ m{/TestSuite.pm$} } all_pm_files();
        plan tests => scalar @modules;
        foreach my $module ( @modules ) {
                pm_file_ok
                ($module);
        }
        return;
 }

Remember that you will need to add the 'use Test::More;' so that you have access to the plan.

SEE ALSO ^

Test::Class

Wetware::Test

Wetware::Test::CreateTestSuite

Wetware::CLI

ACKNOWLEDGEMENTS ^

I really have to blame billbill, because we were talking on the phone and he was talking about creating templates of test code for any given Module Foo....

Soooooo - given the hard lessons learned about what can and can not be done with the whole Test::Class::Load - why not do the nice thing.

TODO ^

Figure out if it is worth it to be able to differenciate between the simple Functional Modules, and the OO style.

Also resolve if we want to work out the inheritence chain, so that we know that Foo::TestSuite is the parent of Foo::Bar::TestSuite, because Foo::Bar is a subclass of Foo.

COPYRIGHT & LICENSE ^

Copyright 2009 "drieux", all rights reserved.

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

syntax highlighting: