Search code examples
javascriptqunit

Qunit is it possible to run tests automatically?


I created several tests in Qunit. Is it possible to run the test automatically ?


Solution

  • I think you can try this way

    <script type="text/javascript">
        var tests = [
            { page: "Page01.htm", title: "Test Page 01 - click me to view test page" },
            { page: "Page02.htm" },
            { page: "Page01.htm" }
        ];
        var seq = true; // false to run tests simultaneously
        var runerDne = function(failures, total) {
            // get notified when runner completes
        }
        QUnit.run(tests, seq, runerDne);
    

    This loads 3 pages automatically and executes accordingly. Hope this helps you.