Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Checking in changes prior to tagging of version 0.08.

Changelog diff is:

diff --git a/Changes b/Changes
index e40d553..3de48dc 100644
--- a/Changes
+++ b/Changes
@@ -2,6 +2,11 @@ Revision history for Perl extension Test::Ika

 {{$NEXT}}

+0.08 2014-03-28T18:30:09Z
+
+    - bypass example and group args to *_each hooks
+      (ikasam_a)
+
 0.07 2013-11-19T05:16:44Z

     - can suppress colorize output in Spec format
latest commit f325b19943
Masaki Nakagawa masaki authored
README.md

NAME

Test::Ika - Yet another BDD testing library(Development Release)

SYNOPSIS

use Test::Ika;

describe 'MessageFilter' => sub {
    my $filter;

    before_each {
        $filter = MessageFilter->new();
    };

    it 'should detect message with profanity word' => sub {
        ok $filter->detect('foo');
    };

    it 'should not detect message without profanity word' => sub {
        ok ! $filter->detect('bar');
    };
};

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.

  • The spec mode(default)

  • TAP output(it's enabled under $ENV{HARNESS_ACTIVE} is true)

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');
        ok $filter->detect('hello foo');
    };
    
  • 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');
        ok $filter->detect('hello foo');
    };
    
  • xit($name, \&code)

  • xit($name, $cond, \&code)

    Create new Test::Ika::Example which marked "disabled".

  • before_suite(\&code)

    Register hook for before running suite.

  • before_all(\&code)

    Register hook for before running example group.

  • before_each(\&code)

    Register hook for before running each examples.

    This block can receive example and example group.

    before_each {
        my ($example, $group) = @_;
        # ...
    };
    
  • after_suite(\&code)

    Register hook for after running suite.

  • after_all(\&code)

    Register hook for after running example group.

  • after_each(\&code)

    Register hook for after running each examples.

    This block can receive example and example group.

    after_each {
        my ($example, $group) = @_;
        # ...
    };
    
  • 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

SEE ALSO

Test::Spec

Test::Behavior::Spec

Test::More::Behaviours

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.

Something went wrong with that request. Please try again.