JSUnitTestRunner Application

This application isn't bundled with any XWiki product by default.
Application contributed by Jerome Velociter.
This application can be downloaded .

JSUnitTestRunner Application

JSUnit Test Runner

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

Please, report to http://www.jsunit.net/ for more information or documentation about JSUnit.

Usage

Run JSUnit standard test runner

Once you have the application installed, just point your browser on http://yourserver/xwiki/bin/view/XWiki/JSUnit and you will be offered JSUnit's standard test runner. This is the same server as the one accessible online, except that it is hosted on your wiki.

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 your 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, as follow:

#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

Tags:
Created by Jerome Velociter on 2009/01/06 15:24
Last modified by Vincent Massol on 2009/05/19 09:11

This wiki is licensed under a Creative Commons license
2.2.1.27354