Search code examples
jsunit

How to create test suite in JsUnit


How do I create a test suite in JsUnit like I would with JUnit? I have many tests that I would like to run together. For example, I have two tests in test1.html and test2.html that I would like to group together to run.


Solution

  • Write a suite function in your page that returns a JsUnitTestSuite.

    function suite(){
      var suite = new JsUnitTestSuite();
      suite.addTestPage("/path/test1.html");//use the addTestPage() method to add a test page
      suite.addTestPage("/path/test2.html");
      return suite;
    }