Running Unit Tests on JavaScript Files

See Also 

The IDE enables you to run unit tests on JavaScript files using JsTestDriver. The test driver will run the unit tests in each of the browsers that you specify when you configure the test driver.

After you create the unit tests for your JavaScript files, you can run the unit tests by performing the following steps.

  1. Download the js-test-driver JAR to your local system.
  2. In the Services window, right-click the JS Test Driver node and choose Configure in the popup menu.
  3. In the Configure JSTestDriver dialog box, click Browse and locate the js-test-driver JAR that you downloaded.
  4. Select the browsers that you want to run the tests against.

    Only browsers that are installed on your local system are displayed in the list.

    Click OK to close the dialog box.
  5. Right-click the JS Test Driver node and choose Start to start the js-test-driver server.

    When you choose Start, each of the browsers that you specified will open a window and will wait to run the unit tests. You can see the status in the js-test-driver server tab in the Output window.

  6. Choose New > New File to open the New File wizard.
  7. Select JsTestDriver Configuration File in the Unit Tests category in the New File wizard.
  8. Use the default name jsTestDriver.conf for the File Name.
  9. Click Browse and select the Configuration Files (the config folder in the project) for the Folder.

    The file name must be jsTestDriver.conf and the file must be in the root of the config folder to enable the Test command for the project. The correct path that is displayed in the Created File text field will be similar to the following:
    <PROJECT_FOLDER>config/jsTestDriver.conf.

    If the config folder does not exist you can create the folder by typing config in the Folder text field or by creating the folder manually and then specifying the folder in the Project Properties window.

    Click Finish.

    When you click Finish the IDE creates the jsTestDriver.conf file and opens the file in the editor. In the Projects window you can see the file under the Configuration Files node.

  10. Edit jsTestDriver.conf to specify the location of the JavaScript source files and test files.
  11. Right-click the project node and choose Test in the popup menu.

When you click Test the IDE runs the unit tests. You can open the Test Results window to view the results. You can see details about the specific tests in the Output window.

Notes.

See Also
About Debugging JavaScript Files
About Editing JavaScript Files

Legal Notices