Core Testing Tools
Skip And Todo Model
Skip and todo annotations explain checks that should not behave like ordinary failures.
skip-todo
Skip means the check cannot run in this environment. Todo means a known unfinished behavior is allowed to fail for now.
Skip And Todo Model
skip_todo_model.pl
Replay: real traced execution (multi-file project)
use strict;
use warnings;
my $feature = "json";
my %available = (
json => 1,
db => 0,
cache => 0,
);
my %known_todo = (
cache => 1,
);
my $state = "run";
if (!$available{$feature}) {
$state = $known_todo{$feature} ? "todo" : "skip";
}
my $line = "$state - $feature";
print "feature=$feature\n";
print "available=$available{$feature}\n";
print "state=$state\n";
print "line=$line\n";
use strict;
use warnings;
my $feature = "db";
my %available = (
json => 1,
db => 0,
cache => 0,
);
my %known_todo = (
cache => 1,
);
my $state = "run";
if (!$available{$feature}) {
$state = $known_todo{$feature} ? "todo" : "skip";
}
my $line = "$state - $feature";
print "feature=$feature\n";
print "available=$available{$feature}\n";
print "state=$state\n";
print "line=$line\n";
use strict;
use warnings;
my $feature = "cache";
my %available = (
json => 1,
db => 0,
cache => 0,
);
my %known_todo = (
cache => 1,
);
my $state = "run";
if (!$available{$feature}) {
$state = $known_todo{$feature} ? "todo" : "skip";
}
my $line = "$state - $feature";
print "feature=$feature\n";
print "available=$available{$feature}\n";
print "state=$state\n";
print "line=$line\n";
$feature ← json, %available ← 3, %known_todo ← 1, $state ← run
4my $feature→ json = "json"; #@feature="db", "cache"5my %available→ 3 = (6 json => 1,7 db => 0,8 cache => 0,9);10my %known_todo→ 1 = (11 cache => 1,12);1314my $state→ run = "run";15if (!$available{$feature}) {16 $state = $known_todo{$feature} ? "todo" : "skip";17}18my $line→ run - json = "$staterun - $featurejson";1920print "feature=$featurejson\n";21print "available=$available1{$featurejson}\n";22print "state=$staterun\n";23print "line=$linerun - json\n";outputfeature=json available=1 state=run line=run - json
$feature ← db, %available ← 3, %known_todo ← 1, $state ← run
4my $feature→ db = "db";5my %available→ 3 = (6 json => 1,7 db => 0,8 cache => 0,9);10my %known_todo→ 1 = (11 cache => 1,12);1314my $state→ run = "run";15if (!$available{$feature}) {$state ← skip
14my $state = "run";15if (!$available{$feature}0) {16 $state→ skip = $known_todo{$feature}(empty) ? "todo" : "skip";17}$line ← skip - db
17}18my $line→ skip - db = "$stateskip - $featuredb";1920print "feature=$featuredb\n";21print "available=$available0{$featuredb}\n";22print "state=$stateskip\n";23print "line=$lineskip - db\n";outputfeature=db available=0 state=skip line=skip - db
$feature ← cache, %available ← 3, %known_todo ← 1, $state ← run
4my $feature→ cache = "cache";5my %available→ 3 = (6 json => 1,7 db => 0,8 cache => 0,9);10my %known_todo→ 1 = (11 cache => 1,12);1314my $state→ run = "run";15if (!$available{$feature}) {$state ← todo
14my $state = "run";15if (!$available{$feature}0) {16 $state→ todo = $known_todo{$feature}1 ? "todo" : "skip";17}$line ← todo - cache
17}18my $line→ todo - cache = "$statetodo - $featurecache";1920print "feature=$featurecache\n";21print "available=$available0{$featurecache}\n";22print "state=$statetodo\n";23print "line=$linetodo - cache\n";outputfeature=cache available=0 state=todo line=todo - cache