Skip to content

Usingjstd

frawa edited this page May 22, 2012 · 2 revisions

This page describes previous experiments using js-test-driver.

Please read TDD to understand how all this can gelp improve development experience.

Test are based on js-test-driver framework. The latest version 1.3.4.b is not (yet) available from a public maven repository, you will need to download and install in your local repository:

  mvn install:install-file -DgroupId=com.google.jstestdriver -Dpackaging=jar -DgeneratePom=true \
    -Dversion=1.3.4.b -DartifactId=jstestdriver -Dfile=JsTestDriver-1.3.4.b.jar
  mvn install:install-file -DgroupId=com.google.jstestdriver  -Dpackaging=jar -DgeneratePom=true \
    -Dversion=1.3.4.b -DartifactId=coverage -Dfile=coverage-1.3.4.b.jar 

To launch your the tests use

mvn test
mvn test -P firefox
mvn test -P chrome
mvn test -P iexplorer
mvn test -P all

Your .m2/settings.xml file needs to bring some additional information

  • For js-test-driver, see here.

  • For TestCodeMirror2 to find your browsers

<properties>
  <ChromePath>C:\Users\IBM_ADMIN\AppData\Local\Google\Chrome\Application\chrome.exe</ChromePath>
  <FirefoxPath>C:\Program Files (x86)\Mozilla Firefox\firefox.exe</FirefoxPath>
  <InternetExplorerPath>C:\Program Files (x86)\Internet Explorer\iexplore.exe</InternetExplorerPath>
</properties>

Hint: You can have additional browser command line arguments using ';', see here, like

<ChromePath>...\chrome.exe;--user-data-dir=remote-profile</ChromePath>

Coverage

To generate the test coverage report use

mvn integration-test -P coverage
mvn integration-test -P coverage,chrome
mvn integration-test -P coverage,firefox
mvn integration-test -P coverage,iexplorer
mvn integration-test -P coverage,all

You will need to have perl on your system and help TestCodeMirror2 find genhtml in lvoc, in your .m2/settings.xml:

  <GenHtmlPath>...\lcov-1.9\bin\genhtml</GenHtmlPath>

Clone this wiki locally