|
@@ -26,8 +26,7 @@ my $tr = new TestRail::API($apiurl,$login,$pw,undef,1);
|
|
|
|
|
|
|
|
#Mock if necesary
|
|
#Mock if necesary
|
|
|
$tr->{'debug'} = 0;
|
|
$tr->{'debug'} = 0;
|
|
|
-
|
|
|
|
|
-$tr->{'browser'} = Test::LWP::UserAgent::TestRailMock::lockMockStep0();
|
|
|
|
|
|
|
+$tr->{'browser'} = $Test::LWP::UserAgent::TestRailMock::mockObject;
|
|
|
|
|
|
|
|
my $runs = TestRail::Utils::Find::findRuns($opts,$tr);
|
|
my $runs = TestRail::Utils::Find::findRuns($opts,$tr);
|
|
|
is(ref $runs, 'ARRAY', "FindRuns returns ARRAYREF");
|
|
is(ref $runs, 'ARRAY', "FindRuns returns ARRAYREF");
|
|
@@ -87,7 +86,7 @@ $opts = {
|
|
|
'names-only' => 1
|
|
'names-only' => 1
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-my $cases = TestRail::Utils::Find::getTests($opts,$tr);
|
|
|
|
|
|
|
+my ($cases) = TestRail::Utils::Find::getTests($opts,$tr);
|
|
|
my @tests = TestRail::Utils::Find::findTests($opts,@$cases);
|
|
my @tests = TestRail::Utils::Find::findTests($opts,@$cases);
|
|
|
@expected = ("$FindBin::Bin/skipall.test");
|
|
@expected = ("$FindBin::Bin/skipall.test");
|
|
|
cmp_deeply(\@tests,\@expected,"findTests: match, no-recurse, plan mode, names-only");
|
|
cmp_deeply(\@tests,\@expected,"findTests: match, no-recurse, plan mode, names-only");
|
|
@@ -100,12 +99,13 @@ cmp_deeply(\@tests,\@expected,"findTests: match, no-recurse, plan mode");
|
|
|
delete $opts->{'match'};
|
|
delete $opts->{'match'};
|
|
|
$opts->{'no-match'} = $FindBin::Bin;
|
|
$opts->{'no-match'} = $FindBin::Bin;
|
|
|
$opts->{'names-only'} = 1;
|
|
$opts->{'names-only'} = 1;
|
|
|
-$cases = TestRail::Utils::Find::getTests($opts,$tr);
|
|
|
|
|
|
|
+$opts->{'extension'} = '.test';
|
|
|
|
|
+($cases) = TestRail::Utils::Find::getTests($opts,$tr);
|
|
|
@tests = TestRail::Utils::Find::findTests($opts,@$cases);
|
|
@tests = TestRail::Utils::Find::findTests($opts,@$cases);
|
|
|
is(scalar(grep {$_ eq 'skipall.test'} @tests),0,"Tests in tree are not returned in no-match mode");
|
|
is(scalar(grep {$_ eq 'skipall.test'} @tests),0,"Tests in tree are not returned in no-match mode");
|
|
|
is(scalar(grep {$_ eq 'NOT SO SEARED AFTER ALL'} @tests),0,"Tests not in tree that do exist are not returned in no-match mode");
|
|
is(scalar(grep {$_ eq 'NOT SO SEARED AFTER ALL'} @tests),0,"Tests not in tree that do exist are not returned in no-match mode");
|
|
|
is(scalar(grep {$_ eq $FindBin::Bin.'/faker.test'} @tests),1,"Orphan Tests in tree ARE returned in no-match mode");
|
|
is(scalar(grep {$_ eq $FindBin::Bin.'/faker.test'} @tests),1,"Orphan Tests in tree ARE returned in no-match mode");
|
|
|
-is(scalar(@tests),26,"Correct number of non-existant cases shown (no-match, names-only)");
|
|
|
|
|
|
|
+is(scalar(@tests),6,"Correct number of non-existant cases shown (no-match, names-only)");
|
|
|
|
|
|
|
|
$opts->{'configs'} = ['testPlatform1'];
|
|
$opts->{'configs'} = ['testPlatform1'];
|
|
|
isnt(exception { TestRail::Utils::Find::getTests($opts,$tr) } , undef,"Correct number of non-existant cases shown (no-match, names-only)");
|
|
isnt(exception { TestRail::Utils::Find::getTests($opts,$tr) } , undef,"Correct number of non-existant cases shown (no-match, names-only)");
|
|
@@ -115,23 +115,23 @@ delete $opts->{'names-only'};
|
|
|
@tests = TestRail::Utils::Find::findTests($opts,@$cases);
|
|
@tests = TestRail::Utils::Find::findTests($opts,@$cases);
|
|
|
my @filtered_tests = grep {defined $_} map {$_->{'full_title'}} @tests;
|
|
my @filtered_tests = grep {defined $_} map {$_->{'full_title'}} @tests;
|
|
|
is(scalar(@filtered_tests),0,"Full titles not returned in no-match mode");
|
|
is(scalar(@filtered_tests),0,"Full titles not returned in no-match mode");
|
|
|
-is(scalar(@tests),26,"Correct number of nonexistant cases shown in no-match mode");
|
|
|
|
|
|
|
+is(scalar(@tests),6,"Correct number of nonexistant cases shown in no-match mode");
|
|
|
|
|
|
|
|
delete $opts->{'no-recurse'};
|
|
delete $opts->{'no-recurse'};
|
|
|
$opts->{'names-only'} = 1;
|
|
$opts->{'names-only'} = 1;
|
|
|
-$cases = TestRail::Utils::Find::getTests($opts,$tr);
|
|
|
|
|
|
|
+($cases) = TestRail::Utils::Find::getTests($opts,$tr);
|
|
|
@tests = TestRail::Utils::Find::findTests($opts,@$cases);
|
|
@tests = TestRail::Utils::Find::findTests($opts,@$cases);
|
|
|
-is(scalar(@tests),30,"Correct number of non-existant cases shown (no-match, names-only, recurse)");
|
|
|
|
|
|
|
+is(scalar(@tests),10,"Correct number of non-existant cases shown (no-match, names-only, recurse)");
|
|
|
|
|
|
|
|
#mutual excl
|
|
#mutual excl
|
|
|
$opts->{'match'} = $FindBin::Bin;
|
|
$opts->{'match'} = $FindBin::Bin;
|
|
|
-$cases = TestRail::Utils::Find::getTests($opts,$tr);
|
|
|
|
|
|
|
+($cases) = TestRail::Utils::Find::getTests($opts,$tr);
|
|
|
isnt(exception {TestRail::Utils::Find::findTests($opts,@$cases)},undef,"match and no-match are mutually exclusive");
|
|
isnt(exception {TestRail::Utils::Find::findTests($opts,@$cases)},undef,"match and no-match are mutually exclusive");
|
|
|
delete $opts->{'no-match'};
|
|
delete $opts->{'no-match'};
|
|
|
|
|
|
|
|
delete $opts->{'plan'};
|
|
delete $opts->{'plan'};
|
|
|
$opts->{'run'} = 'TestingSuite';
|
|
$opts->{'run'} = 'TestingSuite';
|
|
|
-$cases = TestRail::Utils::Find::getTests($opts,$tr);
|
|
|
|
|
|
|
+($cases) = TestRail::Utils::Find::getTests($opts,$tr);
|
|
|
@tests = TestRail::Utils::Find::findTests($opts,@$cases);
|
|
@tests = TestRail::Utils::Find::findTests($opts,@$cases);
|
|
|
is(scalar(@tests),1,"Correct number of non-existant cases shown (match, plain run)");
|
|
is(scalar(@tests),1,"Correct number of non-existant cases shown (match, plain run)");
|
|
|
is(scalar(grep {$_ eq "$FindBin::Bin/skipall.test"} @tests),1,"Tests in tree are returned in match, plain run mode");
|
|
is(scalar(grep {$_ eq "$FindBin::Bin/skipall.test"} @tests),1,"Tests in tree are returned in match, plain run mode");
|
|
@@ -140,24 +140,24 @@ is(scalar(grep {$_ eq "$FindBin::Bin/skipall.test"} @tests),1,"Tests in tree are
|
|
|
$opts->{'plan'} = 'GosPlan';
|
|
$opts->{'plan'} = 'GosPlan';
|
|
|
$opts->{'run'} = 'Executing the great plan';
|
|
$opts->{'run'} = 'Executing the great plan';
|
|
|
$opts->{'users'} = ['teodesian'];
|
|
$opts->{'users'} = ['teodesian'];
|
|
|
-$cases = TestRail::Utils::Find::getTests($opts,$tr);
|
|
|
|
|
|
|
+($cases) = TestRail::Utils::Find::getTests($opts,$tr);
|
|
|
@tests = TestRail::Utils::Find::findTests($opts,@$cases);
|
|
@tests = TestRail::Utils::Find::findTests($opts,@$cases);
|
|
|
is(scalar(@tests),1,"Correct number of cases shown (match, plan run, assignedto pos)");
|
|
is(scalar(@tests),1,"Correct number of cases shown (match, plan run, assignedto pos)");
|
|
|
is(scalar(grep {$_ eq "$FindBin::Bin/skipall.test"} @tests),1,"Tests in tree are returned filtered by assignee");
|
|
is(scalar(grep {$_ eq "$FindBin::Bin/skipall.test"} @tests),1,"Tests in tree are returned filtered by assignee");
|
|
|
|
|
|
|
|
$opts->{'users'} = ['billy'];
|
|
$opts->{'users'} = ['billy'];
|
|
|
-$cases = TestRail::Utils::Find::getTests($opts,$tr);
|
|
|
|
|
|
|
+($cases) = TestRail::Utils::Find::getTests($opts,$tr);
|
|
|
@tests = TestRail::Utils::Find::findTests($opts,@$cases);
|
|
@tests = TestRail::Utils::Find::findTests($opts,@$cases);
|
|
|
is(scalar(@tests),0,"Correct number of cases shown (match, plan run, assignedto neg)");
|
|
is(scalar(@tests),0,"Correct number of cases shown (match, plan run, assignedto neg)");
|
|
|
|
|
|
|
|
delete $opts->{'users'};
|
|
delete $opts->{'users'};
|
|
|
$opts->{'statuses'} = ['passed'];
|
|
$opts->{'statuses'} = ['passed'];
|
|
|
-$cases = TestRail::Utils::Find::getTests($opts,$tr);
|
|
|
|
|
|
|
+($cases) = TestRail::Utils::Find::getTests($opts,$tr);
|
|
|
@tests = TestRail::Utils::Find::findTests($opts,@$cases);
|
|
@tests = TestRail::Utils::Find::findTests($opts,@$cases);
|
|
|
is(scalar(@tests),1,"Correct number of cases shown (match, plan run, passed)");
|
|
is(scalar(@tests),1,"Correct number of cases shown (match, plan run, passed)");
|
|
|
|
|
|
|
|
$opts->{'statuses'} = ['failed'];
|
|
$opts->{'statuses'} = ['failed'];
|
|
|
delete $opts->{'match'};
|
|
delete $opts->{'match'};
|
|
|
-$cases = TestRail::Utils::Find::getTests($opts,$tr);
|
|
|
|
|
|
|
+($cases) = TestRail::Utils::Find::getTests($opts,$tr);
|
|
|
@tests = TestRail::Utils::Find::findTests($opts,@$cases);
|
|
@tests = TestRail::Utils::Find::findTests($opts,@$cases);
|
|
|
is(scalar(@tests),0,"Correct number of cases shown (match, plan run, failed)");
|
|
is(scalar(@tests),0,"Correct number of cases shown (match, plan run, failed)");
|