We're getting occasional failures of tests for timings. Using
the lastUpdated method on a user, for example. I've made two changes to try and fix these: 1) Changed the tests to use cmp_ok instead of ok, so that future failures will print the measured times as a debug, like is and isn't do. 2) Reversed the order of the method and time measurement. This might help the difference stay smaller since the two statements are closer.
This commit is contained in:
parent
f5f239e577
commit
4b891f22f8
1 changed files with 6 additions and 6 deletions
12
t/User.t
12
t/User.t
|
|
@ -36,10 +36,10 @@ ok(defined ($user = WebGUI::User->new($session,"new")), 'new("new") -- object re
|
|||
ok(scalar %{$user->{_profile}} > 0, 'new("new") -- profile property contains at least one key');
|
||||
|
||||
#Let's assign a username
|
||||
$lastUpdate = time();
|
||||
$user->username("bill_lumberg");
|
||||
$lastUpdate = time();
|
||||
is($user->username, "bill_lumberg", 'username() method');
|
||||
ok(abs($user->lastUpdated-$lastUpdate) < 1, 'lastUpdated() -- username change');
|
||||
cmp_ok(abs($user->lastUpdated-$lastUpdate), '<=', 1, 'lastUpdated() -- username change');
|
||||
|
||||
#Let's check the UID and make sure it's sane
|
||||
ok($user->userId =~ m/[A-Za-z0-9\-\_]{22}/, 'userId() returns sane value');
|
||||
|
|
@ -50,10 +50,10 @@ foreach my $groupId (2,7) {
|
|||
}
|
||||
|
||||
#Let's check the status method
|
||||
$lastUpdate = time();
|
||||
$user->status('Active');
|
||||
$lastUpdate = time();
|
||||
is($user->status, "Active", 'status("Active")');
|
||||
ok(abs($user->lastUpdated-$lastUpdate) < 1, 'lastUpdated() -- status change');
|
||||
cmp_ok(abs($user->lastUpdated-$lastUpdate), '<=', 1, 'lastUpdated() -- status change');
|
||||
|
||||
$user->status('Selfdestructed');
|
||||
is($user->status, "Selfdestructed", 'status("Selfdestructed")');
|
||||
|
|
@ -62,10 +62,10 @@ $user->status('Deactivated');
|
|||
is($user->status, "Deactivated", 'status("Deactivated")');
|
||||
|
||||
#Let's get/set a profile field
|
||||
$lastUpdate = time();
|
||||
$user->profileField("firstName", "Bill");
|
||||
$lastUpdate = time();
|
||||
is($user->profileField("firstName"), "Bill", 'profileField() get/set');
|
||||
ok(abs($user->lastUpdated-$lastUpdate) < 1, 'lastUpdated() -- profileField');
|
||||
cmp_ok(abs($user->lastUpdated-$lastUpdate), '<=', 1, 'lastUpdated() -- profileField');
|
||||
|
||||
#Let's check the auth methods
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue