Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>OK, here's something I just brewed based on some earlier work. I hope this would meet your needs.</p> <h2><a href="http://jsunity.com/" rel="nofollow noreferrer">jsUnity</a></h2> <p>Lightweight Universal JavaScript Testing Framework </p> <blockquote> <p><strong>jsUnity</strong> is a lightweight universal JavaScript testing framework that is context-agnostic. It doesn't rely on any browser capabilities and therefore can be run inside HTML, ASP, WSH or any other context that uses JavaScript/JScript/ECMAScript.</p> </blockquote> <h2>Sample usage inside HTML</h2> <pre><code>&lt;pre&gt; &lt;script type="text/javascript" src="../jsunity.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; function sampleTestSuite() { function setUp() { jsUnity.log("set up"); } function tearDown() { jsUnity.log("tear down"); } function testLessThan() { assertTrue(1 &lt; 2); } function testPi() { assertEquals(Math.PI, 22 / 7); } } // optionally wire the log function to write to the context jsUnity.log = function (s) { document.write(s + "&lt;/br&gt;"); }; var results = jsUnity.run(sampleTestSuite); // if result is not false, // access results.total, results.passed, results.failed &lt;/script&gt; &lt;/pre&gt; </code></pre> <p>The output of the above:</p> <pre> 2 tests found set up tear down [PASSED] testLessThan set up tear down [FAILED] testPi: Actual value does not match what's expected: [expected] 3.141592653589793, [actual] 3.142857142857143 1 tests passed 1 tests failed </pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload