PackagePackagetypeA library you install and call yourself.See every one →What this type is →independently maintainedindependently maintainedoriginPublished by one person or a small company outside SAP. Says nothing about quality; the readings say that.See every one →

openui5-smart-mockserver

An extended UI5 MockServer that generates meaningful mock data with Faker.js, from the metadata's sap:semantics annotations or from rules that map an OData property to a Faker method.

The UI5 MockServer answers OData requests from metadata and, left to itself, fills the entities with placeholder values. This library adds a SmartMockServer that generates the data from the metadata's sap:semantics annotations, and for metadata without annotations takes smart rules that map an OData property to a Faker.js method such as name.firstName or internet.email. It is used the way the stock mock server is: create an instance with a rootUri, optionally call setSmartRules(), then simulate() with the metadata URL and bGenerateMissingMockData: true, then start(). The repository carries a browser demo and a ServiceWorker variant of it (demo-sw).

Facts

Latestv1.0.0ReleasedLast pushLicenceMIT

Where it sits

Lives in
Provides
UI5 testingUI5UI5 testingcapabilityProving a UI still works — unit tests over controllers and formatters, integration tests that drive real controls, and end-to-end runs against a served app.
Add-on to
@openui5/sap.ui.core@openui5/sap.ui.coreartifactThe OpenUI5 core: the module loader, the MVC runtime, data binding, routing, theming and the test stack, which is everything a UI5 app does before a single community package is added.
Requires
@openui5/sap.ui.core@openui5/sap.ui.coreartifactThe framework whose MockServer it extends: the library is an extended version of the UI5 MockServer and is registered in the host app's manifest.

Who is behind it

Mauricio LaufferMauricio LaufferPersonMaintains this
In the atlas: maintains 16, contributes to 41, wrote 4
@mauriciolauffer
maintainer

What it declares

Every artifact

Type
Package
Origin
Independently maintained

As a package

Where it runs
does not say
Distributed through
npm

Connections2

Install

npm add openui5-smart-mockserver

Derived from the package name. No recipe recorded; the README has the configuration.

README

quoted from mauriciolauffer/openui5-smart-mockserver under MIT, read
mauriciolauffer/openui5-smart-mockserver/README.mdOn GitHub

openui5-smart-mockserver

npm test

An extended and smarter version of UI5 MockServer for meaningful mock data.

OpenUI5 Smart MockServer uses the open source library Faker.js to generate better fake data for testing your app or for a demo. You can use any available method in Faker.js.

Smart data can be automatically generated based on OData SAP Semantics Annotations. You don't need to code anything, just run Smart MockServer with a metadata.xml containing SAP Semantics Annotations. In case your metadata.xml doesn't have SAP Semantics annotations, you can set Smart Rules manually mapping the OData property to a Faker.js method.

Regular MockServer: just a bunch of texts and numbers Regular MockServer

Smart MockServer: meaningful data, better for tests and presentations to customer Smart MockServer">

OData SAP Semantics Annotations

OData SAP Semantic Annotations tell which of the OData properties contain e.g. a phone number, a part of a name or address, or something related to a calendar event or an analytic query. This is important for apps running on mobile devices that want to seamlessly integrate into contacts, calendar, and telephony. https://wiki.scn.sap.com/wiki/display/EmTech/SAP+Annotations+for+OData+Version+2.0#SAPAnnotationsforODataVersion2.0-Property_sap_semanticsAttributesap:semantics

Smart MockServer will generate data for these properties automatically, but not for all of them, have a look at the demo to see the supported sap:semantics annotations.

Faker.js

For any references, please follow

Faker.js: https://github.com/marak/Faker.js

Faker.js methods: https://github.com/marak/Faker.js/#api-methods

Demo

You can check out a live demo here:

https://mauriciolauffer.github.io/openui5-smart-mockserver/demo/webapp/index.html

And for a live demo using ServiceWorker:

https://mauriciolauffer.github.io/openui5-smart-mockserver/demo-sw/webapp/index.html

Project Structure

  • demo - Library's live demo
  • demo-sw - Library's live demo with ServiceWorker
  • dist - Distribution folder which contains the library ready to use
  • src - Development folder
  • test - Testing framework for the library

Getting started

Installation

Install openui5-smart-mockserver as an npm module

$ npm install openui5-smart-mockserver
Configure manifest.json

Add the library to sap.ui5/dependencies/libs and set its path in sap.ui5/resourceRoots in your manifest.json file, as follows:

{
  "sap.ui5": {
    "dependencies": {
      "libs": {
        "openui5.smartmockserver": {}
      }
    },
    "resourceRoots": {
      "openui5.smartmockserver": "./FOLDER_WHERE_YOU_PLACED_THE_LIBRARY/openui5/smartmockserver/"
    }
  }
}
How to use

You can use Smart MockServer just like you use your old MockServer! Import openui5-smart-mockserver to your UI5 controller using sap.ui.define or sap.ui.require:

sap.ui.define([
    'openui5/smartmockserver/SmartMockServer'
  ], function (SmartMockServer) {
    'use strict';

    return {
      init: function() {
        const metadataUrl = 'local/path/to/the/file/metadata.xml';
        const mockServerUrl = 'odata/service/url';
        const mockServer = new SmartMockServer({ rootUri: mockServerUrl });

        // You only need to call this method in case your metadata.xml doesn't have sap:semantics annotations
        // and you want to create nice data for the OData property
        mockServer.setSmartRules(this._getSmartRules());

        SmartMockServer.config({
          autoRespond: true,
          autoRespondAfter: 1
        });

        mockServer.simulate(metadataUrl, {
          bGenerateMissingMockData: true
        });

        mockServer.start();
      },

      _getSmartRules: function() {
      //Here we define the smart rules for entity's properties
        const smartRules = []; //Smart rules must be an array with objects such as the following example
        smartRules.push({
          entityName: 'Employee', //Entity Name
          properties: [
            {
              name: 'FirstName', // Entity's property name
              fakerMethod: 'name.firstName' //Faker.js method which will be used for this property
            },
            { name: 'Address', fakerMethod: 'location.streetAddress' },
            { name: 'Phone', fakerMethod: 'phone.number' },
            { name: 'Email', fakerMethod: 'internet.email' }
          ]
        });
        return smartRules;
      }
    };
  }
);

Author

Mauricio Lauffer

License

This project is licensed under the MIT License - see the LICENSE file for details

MIT, read

History

Latest

v1.0.0

Breaking 2, Features 2

Notes
⚠ BREAKING CHANGES
  • Update to faker v8
  • Use new sap.ui.core.Lib from v1.120.0
Features
  • Update to faker v8 (9b2146f)
  • Use new sap.ui.core.Lib from v1.120.0 (2f1a174)
1downloads per week, npm
Weekly downloads for openui5-smart-mockserver26 complete calendar weeks from 2026-04-20 to 2026-10-18; the latest total is 1.20 Apr – 26 Apr: 2827 Apr – 3 May: 474 May – 10 May: 1911 May – 17 May: 2518 May – 24 May: 425 May – 31 May: 91 Jun – 7 Jun: 708 Jun – 14 Jun: 4615 Jun – 21 Jun: 4122 Jun – 28 Jun: 2229 Jun – 5 Jul: 116 Jul – 12 Jul: 1413 Jul – 19 Jul: 620 Jul – 26 Jul: 2527 Jul – 2 Aug: 73 Aug – 9 Aug: 3910 Aug – 16 Aug: 2217 Aug – 23 Aug: 15124 Aug – 30 Aug: 2031 Aug – 6 Sept: 147 Sept – 13 Sept: 2414 Sept – 20 Sept: 2821 Sept – 27 Sept: 428 Sept – 4 Oct: 75 Oct – 11 Oct: 2212 Oct – 18 Oct: 1
UI5 testing
  1. ui5-test-runnerCommand line running UI5 QUnit and OPA tests in parallel
  2. ui5-middleware-odata-recorderUI5 middleware recording OData traffic as mock server datasets
  3. jest-environment-ui5Jest environment running UI5 unit tests in Node.js
  4. vitest-environment-ui5Vitest environment running UI5 unit tests in Node.js
  5. wdio-qunit-serviceWebdriverIO service running QUnit test pages
  6. @openui5/sap.ui.coreFramework core: module loader, MVC runtime, binding, routing, theming
  7. karma-ui5-transpileKarma preprocessor transpiling UI5 sources via ui5-tooling-transpile
  8. ui5-journey-recorderChrome extension generating OPA5 or wdi5 tests from recorded journeys
  9. wdi5-cucumberwdi5 plugin for Cucumber-style BDD tests on Fiori Elements apps
  10. wdi5-fe-selectorswdi5 selectors for locating controls in Fiori Elements apps
  11. wdio-ui5-serviceEnd-to-end testing for UI5 on WebdriverIO with UI5 control selectors
  12. @ui5/middleware-code-coverageUI5 CLI middleware for Istanbul code coverage
  13. vscode-ui5-odata-mock-generatorVS Code extension generating OData mock data from service metadata

Details

Sources4
Added by handdiscovered herechecked
npm registry, openui5-smart-mockserverversion, releases, installschecked
README.mdquoted, and what the entry declareschecked

Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.

Compatibility and provenance
latestv1.0.0
first release
releases and cadence18, ~114d median
discovered viaAdded by hand
first seen in the atlas
ecosystem and domainui5, developer-experience
History in the atlas1
  1. First seen.
For your agent
Ref
artifact:mauriciolauffer-openui5-smart-mockserver
JSON
/artifacts/mauriciolauffer-openui5-smart-mockserver.json
MCP
Connecting an agent