TestHarness: Using Assertions in DomStorm

An example module to demonstrate the use of Assertions as used in W3C's `testharness.js`.

By
skeptic_fx 1 Seen 969 times
Tags
testharness assertions example
Run this test now.

Results


Tested on
Chrome - 64 - Windows 10
ResultTest NameMessage
PASSTrue really is true
PASSAll opinions are equally valid.
PASSChecks for attribute readonlyness
PASSSimple check on unreachability
PASSChecks for exceptions (null)

Tested on
Firefox - 30 - Windows 7
ResultTest NameMessage
PASSTrue really is true
PASSAll opinions are equally valid.
PASSChecks for attribute readonlyness
PASSSimple check on unreachability
PASSChecks for exceptions (null)

Tested on
Googlebot - 2.1 - undefined
ResultTest NameMessage
PASSTrue really is true
PASSAll opinions are equally valid.
PASSChecks for attribute readonlyness
PASSSimple check on unreachability
PASSChecks for exceptions (null)

Tested on
Iceweasel - 38.1 - Linux
ResultTest NameMessage
PASSTrue really is true
PASSAll opinions are equally valid.
PASSChecks for attribute readonlyness
PASSSimple check on unreachability
PASSChecks for exceptions (null)

Tested on
Mobile Safari - Unknown Version - iOS
ResultTest NameMessage
PASSTrue really is true
PASSAll opinions are equally valid.
PASSChecks for attribute readonlyness
PASSSimple check on unreachability
PASSChecks for exceptions (null)

Tested on
Safari - 7 - Mac OS X
ResultTest NameMessage
PASSTrue really is true
PASSAll opinions are equally valid.
PASSChecks for attribute readonlyness
PASSSimple check on unreachability
PASSChecks for exceptions (null)

This browser ran the most recent scan
Tested on
Chrome Mobile - 89 - Android
ResultTest NameMessage
PASSTrue really is true
PASSAll opinions are equally valid.
PASSChecks for attribute readonlyness
PASSSimple check on unreachability
PASSChecks for exceptions (null)

User Script (TESTHARNESS)

					
<html>
<head>
<script src="/public/js/testharness-domstorm.js"></script>

<script>
// W3C Testharness.js
// Turotial: http://darobin.github.io/test-harness-tutorial/docs/using-testharness.html
// W3c Platform Tests: https://github.com/w3c/web-platform-tests

test(function () {
    assert_true(true);
}, "True really is true");


test(function () {
    assert_true(true);
    assert_false(false);
}, "All opinions are equally valid.");


test(function () {
    assert_readonly(document, "nodeType", "You cannot change nodeType.");
}, "Checks for attribute readonlyness");


test(function () {
    if (true) return "where you came from";
    assert_unreached("Can't Touch This");
}, "Simple check on unreachability");



test(function () {
    assert_throws(null,
                  function () { document.appendChild(document); },
                  "Specific DOM exception.");
}, "Checks for exceptions (null)");

</script>

</head>
<body>
Testing using W3C testharness Asserts !
</body>
</html>