cogJSUnit Test Runner
TypeXAR
Developed by

Jerome

Rating
Rate!
0 Votes
LicenseGNU Lesser General Public License 3
Installable with the Extension Manager

Description

Integration of JSUnit "Unit Testing framework for client-side (in-browser) JavaScript" into XWiki. It lets you run its javascript test runner from XWiki, and write your tests directly in XWiki pages.

Please, report to the Github page for more information or documentation about JSUnit.

Usage

Run JSUnit standard test runner

Once you have the application installed, just point your browser to http://yourserver/xwiki/bin/view/XWiki/JSUnit and you will be offered JSUnit's standard test runner.

Write javascript tests as XWiki pages

With the XWiki integration of JSUnit, you can write test cases or test suites directly as wiki pages. For this, you just need to JSX use the page XWiki.JSUnit, and you can get started:

$xwiki.jsx.use("XWiki.JSUnit")
<script type="text/javascript">
function testSomething(){
    assertEquals(1, 1);
}

...
</script>

As a bonus, you can add a test runner for your XWiki test page, which will offer you in view mode a button to run only the test case/suite that is hosted on the wiki document.

For this, just include XWiki.JSUnit with the velocity includeTopic macro, like in this following code:

#includeTopic("XWiki.JSUnit")
$xwiki.jsx.use("XWiki.JSUnit")
<script type="text/javascript">
... // your tests here
</script>

Then you'll be able to run the tests/suite defined directly on its own page:

XWikiJSUnitTest.png

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager). Note that installing Extensions when being offline is currently not supported and you'd need to use some complex manual method.

You can also use the following manual method, which is useful if this extension cannot be installed with the Extension Manager or if you're using an old version of XWiki that doesn't have the Extension Manager:

  1. Log in the wiki with a user having Administration rights
  2. Go to the Administration page and select the Import category
  3. Follow the on-screen instructions to upload the downloaded XAR
  4. Click on the uploaded XAR and follow the instructions
  5. You'll also need to install all dependent Extensions that are not already installed in your wiki
Tags:
Created by Jerome on 2009/01/06 15:24
    

Get Connected