View source | Discuss this page | Page history | Printable version   
Main Page
Upload file
What links here
Recent changes

PDF Books
Add page
Show collection (0 pages)
Collections help


How to create QUnit testcases



Openbravo provides QUnit library as framework to write JavaScript unit test cases.


The flow

QUnit test cases defined within Openbravo are executed by opening http(s)://your.server/openbravoContext/web/org.openbravo.client.kernel/ui-test-suite/ URL. When accessing this URL this flow is executed:

Creating a new QUnit test case

Declaring JavaScript test resources

Openbravo QUnit test cases are written as JavaScript static resources, which needs to be declared in the ComponentProvider of the module that deploys them. They must be declared in the getTestResources method.

public class ExampleComponentProvider extends BaseComponentProvider {
  public List<String> getTestResources() {
    final List<String> testResources = new ArrayList<String>();
    return testResources;
Bulbgraph.png   JavaScript test resources are only loaded when QUnit test cases are executed, they are not part of the common static resources that compose the application.

Implementing a test case

Once the file with the test case is declared in the ComponentProvider it will be loaded when QUnit test cases are executed.

Test cases look like:

/*global QUnit */
QUnit.test('Test 1', function () {
  QUnit.ok(isc, 'isc object is present');
  QUnit.ok(OB, 'OB object is present');
QUnit.test('Test 2', function () {
 // ...

Comprehensive documentation can be found in the QUnit site.


All QUnit test cases are executed by just opening http(s)://your.server/openbravoContext/web/org.openbravo.client.kernel/ui-test-suite/ URL.


Continuous Integration

All Qunit test cases defined within Openbravo 3 distribution modules are automatically executed as part of the Continuous_Integration.

All of them appear in int-gui > com.openbravo.test.integration.qunit.testscripts > QUnitExecution

Retrieved from ""

This page has been accessed 773 times. This page was last modified on 8 May 2015, at 17:42. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.