View source | Discuss this page | Page history | Printable version   

How to create QUnit testcases

Bulbgraph.png   Starting to PR20Q1 QUnit testing support will be completely removed and replaced by Jest. See How to create Jest test cases for more info



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 4,637 times. This page was last modified on 18 November 2019, at 12:49. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.