Test::Stream::Manual::ToTest2 - How to move code to Test2/Test2-Suite
Test::Stream is deprecated in favor of Test2, Test2::Suite, and Test2::Workflow.
This section briefly tells you where to look for replacements.
If you used the context() method it can now be found in Test2::API, usage is identical. Converting from Test-Stream's context() function could be as easy as changing use Test::Stream::Context qw/context/ to use Test2::API qw/context/.
context()
use Test::Stream::Context qw/context/
use Test2::API qw/context/
One major gotcha though is that the debug() attribute is gone. Instead there is a trace() attribute, but its usage is not identical.
debug()
trace()
TODO and SKIP are no longer managed inside the Context and DebugInfo objects. Skip is now a full fledged event type Test2::Event::Skip, and Test2::API::Context has added a skip() method.
Test2::Event::Skip
Test2::API::Context
skip()
TODO is no longer tracked at all by the Test2 internals. Instead look at Test2::Tools::Todo and/or Test2::Todo which are both part of Test2::Suite. These tools manage TODO as a hub filter.
IPC has not changed much. Load the Test2::IPC module to make sure IPC is loaded if you need it.
Test::Stream::Capabilities has been merged with Test::Stream::Util in Test2::Util.
Test::Stream::Exporter is completely gone. Use Exporter, Export::Declare, Exporter::Declare, or Sub::Exporter.
See Test2::Util::HashBase.
Change
use Test::Stream::HashBase( base => 'Parent::Class', accessors => [qw/foo bar baz/], );
To
use parent 'Parent::Class'; use Test2::Util::HashBase qw/foo bar baz/;
See Test2::Event for the new event base class. Very little has changed apart from the HashBase usage.
Test::Stream::Sync has been replaced by Test2::API. One major difference is that Test2::API exports functions, you do not call clas methods on it the way you did with Test2::Sync. Test2::API also adds and renames several functions.
Test::Stream::Hub and Test::Stream::State have been merged into Test2::API::Stack. Methods form both are now in a single class. Some deprecated methods were removed.
There is a new namespace layout. Test::Stream::Plugin:: has been split into:
Test::Stream::Plugin::
Tools live here.
Bundles live here.
Plugins (behavior modifications) live here.
Things that cause a test to skip all live here.
Formatters live here.
Test::Stream::Bundle::V1 is now spelled Test2::Bundle::Extended.
Test::Stream::Bundle::Classic is now spelled Test2::Bundle::Classic.
All the spec and workflow stuff has moved to Test2::Workflow. This was never maked stable so I don't expect anyone to need a conversion guide.
Test2::API now exports the $events = intercept { ... } function.
$events = intercept { ... }
The source code repository for Test::Stream can be found at http://github.com/Test-More/Test-Stream/.
Copyright 2015 Chad Granum <exodist7@gmail.com>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://dev.perl.org/licenses/
To install Test::Stream, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Stream
CPAN shell
perl -MCPAN -e shell install Test::Stream
For more information on module installation, please visit the detailed CPAN module installation guide.