NAME
Test::Ika - Yet another BDD testing library(Development Release)
SYNOPSIS
use Test::Ika;
use Test::Expects;
describe 'MessageFilter' => sub {
my $filter;
before_each {
$filter = MessageFilter->new();
};
it 'should detect message with NG word' => sub {
my $filter = MessageFilter->new('foo');
expect($filter->detect('hello foo'))->ok;
};
it 'should detect message with NG word' => sub {
my $filter = MessageFilter->new('foo');
expect($filter->detect('hello foo'))->ok;
};
};
runtests;
DESCRIPTION
Test::Ika is yet another BDD framework for Perl5.
This module provides pretty output for testing.
THIS IS A DEVELOPMENT RELEASE. API MAY CHANGE WITHOUT NOTICE.
FAQ
- Ika?
-
This module is dedicated to ikasam_a, a famous Japanese testing engineer.
- Why another one?
-
This module focused to pretty output. Another modules doesn't provide this feature.
- Where is 'should'?
-
I think the keyword 'should' is not a core feature of BDD.
Reporters
Test::Ika provides some reporters.
FUNCTIONS
describe($name, $code)
-
Create new Test::Ika::ExampleGroup.
- context
-
It's alias of 'describe' function.
it($name, \&code)
-
Create new Test::Ika::Example.
it($name, $cond, \&code)
-
Create new conditional Test::Ika::Example.
$cond
is usually a sub-routine reference. You can set it with "when" statement.# run this example, if C<$ENV{TEST_MESSAGE}> returns true my $cond = sub { $ENV{TEST_MESSAGE} }; it 'should detect message', $cond => sub { my $filter = MessageFilter->new('foo'); expect($filter->detect('hello foo'))->ok; };
when(\&code)
-
Specify conditional sub-routine.
You can write conditional example as shown below:
it 'should detect message', when { $ENV{TEST_MESSAGE} } => sub { my $filter = MessageFilter->new('foo'); expect($filter->detect('hello foo'))->ok; };
xit($name, \&code)
xit($name, $cond, \&code)
-
Create new Test::Ika::Example which marked "disabled".
before_suite(\&code)
-
Register hook.
before_all(\&code)
-
Register hook.
before_each(\&code)
-
Register hook.
after_suite(\&code)
-
Register hook.
after_all(\&code)
-
Register hook.
after_each(\&code)
-
Register hook.
runtests()
-
Do run test cases immediately.
Normally, you don't call this method expressly. Test::Ika runs test cases on END { } phase.
CLASS METHODS
Test::Ika->reporter()
-
Get a reporter instance.
Test::Ika->set_reporter($module)
-
Load a reporter class.
AUTHOR
Tokuhiro Matsuno <tokuhirom AAJKLFJEF@ GMAIL COM>
SEE ALSO
LICENSE
Copyright (C) Tokuhiro Matsuno
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.