Skip to content

Can not skip test class with test_skip method #25

@potatogim

Description

@potatogim

Hi, I have a question about 'is_skipped()' method.

I make some class and then wrote test code that have skip test. (naturally, in the startup method)

but after run $test_suite->runtests and run $report->all_test_classes, checking skipped test class(is_skipped()) was not working right.

Code

...

use Test::Class::Moose::Load abs_path(dirname $0) . '/t/lib';

...

### MyTest is parent class of the Test::Sample1, Test::Sample2 
my $test_suite = Test::MyTest->new(
    test_classes => ['Test::Sample1', 'Test::Sample2']
);

...

subtest 'UnitTest Suite' => sub
{
    $test_suite->runtests;
};

my $report = $test_suite->test_report;

for my $class ($report->all_test_classes)
{
    my $class_name = $class->name;

    ok (!$class->is_skipped, "$class_name was not skipped");

Output

ok 3 - Test::Sample1 methods
# Run-time for Test::Sample1: 0.044265 wallclock secs ( 0.04 usr +  0.00 sys =  0.04 CPU)
not ok 4 - Test::Sample2 was not skipped
#   Failed test 'Test::Sample2 was not skipped'
#   at UnitTest line 74.
    # Subtest: Test::Sample2 methods
    1..0
    # No tests run!
not ok 5 - No tests run for subtest "Test::Sample2 methods"
#   Failed test 'No tests run for subtest "Test::Sample2 methods"'
#   at UnitTest line 89.
Can't call method "duration" on an undefined value at UnitTest line 92.
# Tests were run but no plan was declared and done_testing() was not seen.
# Looks like your test exited with 29 just after 5.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions