
Product
Socket for Jira Is Now Available
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.
karma-openui5
Advanced tools

Adapter for OpenUI5/SAPUI5 UI framework. This adapter loads OpenUI5/SAPUI5 from the specified location and makes it available for the tests to run in karma afterwards.
The easiest way is to add karma-openui5 as a devDependency in your package.json.
{
"devDependencies": {
"karma-openui5": "~0.2"
}
}
Information on how to install karma can be found here.
The following code shows the available configuration options.
For the client OpenUI5 configuration you can create an object using any of the options described in the documentation.
To automatically load test modules (via sap.ui.require), the tests config can be set to an array of module names. When using this config, the relevant files must not be included via the files config of Karma.
This is very similar to how RequireJS works with Karma, but without the need for a custom test-main.js file.
For the mockserver config you can pass an object like you would do it for the sap.ui.core.util.MockServer.config
function. The rootUri and the metadataURL are required properties if you use the mock server. You can also pass
mockdata settings like you would do it for the simulate function of the MockServer. The MockServer needs to be
enabled explicitly by settings the useMockServer option.
// karma.conf.js
module.exports = function(config) {
config.set({
frameworks: ['openui5'],
openui5: {
path: 'http://path/to/sap-ui-core.js',
useMockServer: false
},
client: {
openui5: {
config: {
theme: 'sap_belize'
},
tests: [
'name/of/test/module/to/be/loaded',
'other/name/of/test/module/to/be/loaded'
],
mockserver: {
config: {
autoRespond: true
},
rootUri: '/my/service/',
metadataURL: '/base/test/mock.xml',
mockdataSettings: {
}
}
}
}
});
};
Do no require QUnit resources from within the tests. Karma loads its own versions of them in order hook in its reporting at the right places.
Therefore rather load those resources in the non-karma specific test runner HTML pages. Like this:
<script src="../../resources/sap/ui/thirdparty/qunit.js"></script>
<script src="../../resources/sap/ui/qunit/qunit-css.js"></script>
Only relevant when using Istanbul to create test coverage
Istanbul has problems collecting code coverage results from within iFrames. To gather code coverage from OPA5 tests you need to execute them inside of component containers instead of iFrames. This will also speed up the execution time of your OPA5 tests.
Notice: With component containers you will loose the isolation of your single tests. Also, your applications index.html won't be executed anymore (as only the applications Component.js will be needed).
In your tests, replace iStartMyAppInAFrame() withiStartMyUIComponent() and iTeardownMyAppFrame() with iTeardownMyUIComponent().
For more information see the API reference of sap.ui.test.Opa5
(c) Copyright 2017 SAP SE or an SAP affiliate company
Licensed under the Apache License, Version 2.0 - see LICENSE.
FAQs
A Karma plugin. Adapter for OpenUI5/SAPUI5 Framework
The npm package karma-openui5 receives a total of 6,395 weekly downloads. As such, karma-openui5 popularity was classified as popular.
We found that karma-openui5 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.