Thursday, November 5th, 2009
Riot.js: JavaScript port of the lean fast unit test framework
<>p>Riot started as a lean Ruby unit test framework with tests that have a style like this:-
context "a new user" do
setup { User.new }
asserts("that it is not yet created") { topic.new_record? }
end
Alex Young has now implemented Riot.js which brings you the lean framework in a format that can run stand-along via Rhino, or through the browser itself with tests that look like:
-
-
Riot.run(function() {
-
context('basic riot functionality', function() {
-
given('some simple equality tests', function() {
-
asserts('a simple truth test should return true', true).isTrue();
-
asserts('isNull is null', null).isNull();
-
});
-
-
given('another context', function() {
-
asserts('equals should compare strings as expected', 'test string').equals('test string');
-
});
-
-
given('a context concerned with functions', function() {
-
asserts('asserts() should allow functions to be compared', function() {
-
return 'test string';
-
}).equals('test string');
-
});
-
});
-
-
given('yet another context', function() {
-
asserts('equals should compare strings as expected', 'test string').equals('test string');
-
});
-
});
-
Related Content:











^ Hilarious spam post wuwei. Failed attempt in boosting Google search ranking.
I might give Riot a try, in need of a real simple Unit Tester for js.