CI/CD and Testing
|
This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production. |
When several people change an application, someone has to answer the same questions after every change: does it still
build, do the tests still pass, and can the result be delivered to a test system without hand work? Doing that by hand
does not scale, so teams write the answers down as automated tests and as a pipeline, a fixed list of steps that a
server runs after each push to Git. This page shows what that looks like in the SAP world: how to test a CAP service,
a SAPUI5 application and ABAP code, and which SAP services and tools run those tests as a pipeline. The page is written
against CAP Node.js 10.2 (@sap/cds 10.2.2, @cap-js/cds-test 1.0.2), UI5 Tooling 4.0.73 with the UI5 linter 1.23.8
and OpenUI5 1.154.0, ABAP in the release line of the ABAP pages of this site, and the SAP Continuous Integration and
Delivery service on SAP BTP in the Cloud Foundry environment. The CAP and UI5 listings were run for real on 2026-11-13
in a copy of the lab project. Everything that needs an SAP BTP account or an ABAP system is described only and
labeled as not run.
Before you read
-
CAP Getting Started: the lab project that the test listings use.
-
CAP Services and Handlers (Node.js): the custom code that the service tests exercise.
-
CAP Deployment and MTA: the archive that a delivery pipeline builds.
-
SAPUI5 Basics: the application structure that the front-end tests check.
-
ABAP Unit and Test Doubles and ABAP Test Cockpit (ATC): the ABAP side of testing.
Key terms
-
CI/CD: continuous integration (build and test every change automatically) and continuous delivery (move a tested build toward production with little hand work).
-
Pipeline: the fixed list of steps, called stages, that a server runs after a change.
-
cds.test: the CAP helper that starts a service inside a test and sends HTTP requests to it.
-
QUnit: the JavaScript unit test framework that SAPUI5 uses for small tests.
-
OPA5: One Page Acceptance tests, the SAPUI5 way to click through one running page in a test.
-
wdi5: an end-to-end test tool for SAPUI5 applications that runs in a real browser.
-
ABAP Unit: the unit test framework built into ABAP.
-
ABAP Test Cockpit (ATC): the ABAP tool that checks code for quality and release rules.
-
SAP Continuous Integration and Delivery: the SAP BTP service that runs predefined pipelines for SAP development projects.
-
Project Piper: SAP’s open-source pipeline library and command line tool.
What is automated, and where
A change to an SAP application can break very different things, so the tests come in layers, each cheap and fast at the bottom and slower but closer to the user at the top. The table lists the layers of this page, who the tool belongs to, and where the page shows it.
| Layer | What it checks | Tool on this page |
|---|---|---|
Static checks |
Style, outdated APIs and rule violations, without running the code |
|
Service tests |
A CAP service answers HTTP requests correctly, with real handlers and an in-memory database |
|
UI unit tests |
One JavaScript function or controller method |
QUnit |
UI integration tests |
One page of the running application, clicked like a user would |
OPA5 |
End-to-end tests |
The deployed application in a real browser |
wdi5 |
ABAP unit tests |
One ABAP class method, with test doubles for the database |
ABAP Unit |
Source: CAP: Testing with cds.test, wdi5 on GitHub and the pages named in the following sections
A pipeline then runs these layers in a fixed order after every push. The next diagram shows the order of the stages that the SAP Continuous Integration and Delivery service documents for a Cloud Foundry job; a section below explains each stage.
Source: the stage names and their order in Configure a Cloud Foundry Environment Job in Your Repository (SAP Continuous Integration and Delivery documentation source on GitHub); each stage is optional except the build
Testing a CAP service with cds.test
The lab project expenses has one service, ExpenseService, with a draft-enabled entity Claims and a handler that
rejects a negative amount when a draft is saved. To test it, you do not start the server by hand. The helper
cds.test starts the project inside the test process, returns request functions such as GET and POST that already
know the server address, and shuts the server down at the end. The CAP documentation states that cds.test(...)
starts a CAP server for a project and must be called first in each test file, and that the helper is added as a
development dependency with npm add -D @cap-js/cds-test. The lab already lists it in its package.json.
import cds from '@sap/cds'
import { test } from 'node:test'
import assert from 'node:assert'
const { GET } = cds.test(import.meta.dirname + '/..')
test('lists claims', async () => {
const { data } = await GET('/odata/v4/expense/Claims')
assert.ok(data.value.length >= 1)
})
Source: test/service.test.js of the lab project (modules/ROOT/examples/sap-lab/expenses), using the API described in CAP: Testing with cds.test
The first test only reads. A second test checks the custom handler. Saving a draft with a negative amount must fail
with HTTP status 400 and the message of the handler. It first creates a draft with POST, then activates it with the
draftActivate action that every draft-enabled entity offers, and passes the option validateStatus so that the
client returns the 400 answer instead of throwing.
import cds from '@sap/cds'
import { test } from 'node:test'
import assert from 'node:assert'
const { POST } = cds.test(import.meta.dirname + '/..')
test('rejects a negative amount on save', async () => {
const { data: draft } = await POST('/odata/v4/expense/Claims', { title: 'Taxi', amount: -5 })
const res = await POST(`/odata/v4/expense/Claims(ID=${draft.ID},IsActiveEntity=false)/ExpenseService.draftActivate`, {}, { validateStatus: () => true })
assert.strictEqual(res.status, 400)
assert.match(res.data.error.message, /negative/)
})
Source: a test file added to the copy of the lab project, written against CAP: Testing with cds.test and the handler in srv/expense-service.js; this second file is not part of the committed lab project
CAP documents several runners. cds test is a wrapper around Node’s built-in runner with cleaner output, and the same
page lists node --test, Vitest, Jest and Mocha. Running the two test files with npm test and with cds test gave this output in
the lab copy (Node.js 24.21.0):
$ npm test
> expenses@1.0.0 test
> node --test
✔ lists claims (165.113042ms)
✔ rejects a negative amount on save (179.59775ms)
ℹ tests 2
ℹ suites 0
ℹ pass 2
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 246.697125
$ npx cds test
Running 2 test suites...
✔ test/service.test.js
✔ test/validation.test.js
2 in 2 suites passed
0.246s
Source: real output of npm test and npx cds test in the lab copy; the runners are described at CAP: Testing with cds.test
Two properties matter for a pipeline. First, a failing test makes the command end with a non-zero exit code, which is
what a server reads as "this build is broken". When the expected status of the second test was changed to 200 on
purpose, cds test printed AssertionError ... 400 !== 200, marked the suite with a cross, and exited with code 1;
node --test exited with code 1 as well. Second, Node’s own runner can measure coverage. With the flag
--experimental-test-coverage the run printed a table in which srv/expense-service.js showed 100 percent of lines,
branches and functions, and adding --test-coverage-lines=101 made the run fail with exit code 1, which shows how a
minimum coverage can stop a build. Coverage flags of Node’s runner may change between Node versions, so check them
for your version.
The CAP documentation adds two cautions: call cds.test only once per test file, because several calls can leave the
shared server state in conflict, and avoid heavy mocking such as Jest’s fake timers, which can interfere with server
shutdown. For login-protected services, the request functions take an auth option with a user name and password, and
the mocked users of the development profile make this work without any identity service; the page
CAP Security shows the 401 and 403 answers. A test for a service that talks to SAP HANA
in a pipeline needs the cds bind setup that the same page describes, which needs an SAP BTP account and was not run.
Static checks for SAPUI5 with the UI5 linter
Before any test runs, a linter can find problems for free. The UI5 linter is a separate npm package, @ui5/linter,
with the command ui5lint. The UI5 Tooling command ui5 has no lint command in version 4.0.73: running ui5 lint
printed Unknown argument: lint, so a pipeline calls npx ui5lint. The scratch project was a minimal application with
a component, an XML view, a controller and a manifest.json, with the manifest version set to 1.65.0, and the first run reported:
$ npx ui5lint
UI5 linter report:
webapp/manifest.json
1:2 error manifest.json must be migrated to Version 2 no-outdated-manifest-version
1 problem (1 error, 0 warnings)
Run "ui5lint --fix" to resolve all auto-fixable problems
Source: real output of ui5lint 1.23.8 in a scratch UI5 project (the folder path of the report is shortened), UI5 linter on GitHub
The exit code was 1, so a pipeline stops on such a finding. After the manifest version was set to 2.0.0 by hand, the linter found
the next problem: the property /sap.ui5/rootView/async has been removed in manifest version 2 and must no longer be
provided (rule no-removed-manifest-property). After that property was deleted, the run ended with Success! No
findings detected. and exit code 0. The linter is therefore also a guide through the migration to manifest version 2.
The linter package states the Apache-2.0 license.
For the application folder, npx ui5 build --dest dist also succeeded and wrote Component-preload.js and the copied
manifest.json, view and controller folders, in 63 milliseconds. A build is a cheap check that every module can be
resolved.
Testing SAPUI5 with QUnit and OPA5
SAPUI5 ships its own test libraries inside sap.ui.core. QUnit tests small pieces of code. OPA5 starts the whole
application component in a test page and drives its controls the way a user would, waiting automatically until a
control is ready. The installed library 1.154.0 contains sap/ui/test/Opa5.js with the methods iStartMyUIComponent
and iTeardownMyApp, sap/ui/test/opaQunit.js, the action sap/ui/test/actions/Press.js and the test starter in
sap/ui/test/starter/ with runTest.js and createSuite.js.
A unit test needs one module that exports the code under test and one test module. The controller of the scratch
application has a method total that adds numbers:
sap.ui.define(["guide/expenses/controller/Main.controller"], function (Main) {
"use strict";
QUnit.module("Main controller");
QUnit.test("adds amounts", function (assert) {
assert.strictEqual(Main.prototype.total([1, 2, 3.5]), 6.5);
});
});
Source: a test module of the scratch UI5 project (webapp/test/unit/Main.qunit.js), written against the test library in OpenUI5 1.154.0 and the SAPUI5 SDK
An OPA5 test is a journey: a start step, one or more actions and one or more checks. The journey below starts the component, finds the button with the text Total, presses it, and then checks that the page with the title Expenses is still shown.
sap.ui.define([
"sap/ui/test/Opa5",
"sap/ui/test/opaQunit",
"sap/ui/test/actions/Press",
"sap/ui/test/matchers/PropertyStrictEquals"
], function (Opa5, opaTest, Press, PropertyStrictEquals) {
"use strict";
Opa5.extendConfig({ autoWait: true });
QUnit.module("Main page");
opaTest("shows the Total button and lets the user press it", function (Given, When, Then) {
Given.iStartMyUIComponent({ componentConfig: { name: "guide.expenses" } });
When.waitFor({
controlType: "sap.m.Button",
matchers: new PropertyStrictEquals({ name: "text", value: "Total" }),
actions: new Press(),
errorMessage: "The Total button was not found"
});
Then.waitFor({
controlType: "sap.m.Page",
matchers: new PropertyStrictEquals({ name: "title", value: "Expenses" }),
success: function () { Opa5.assert.ok(true, "The page is still shown"); },
errorMessage: "The page was not found"
});
Then.iTeardownMyApp();
});
});
Source: webapp/test/integration/MainJourney.js of the scratch UI5 project, written against the OPA5 modules of OpenUI5 1.154.0 and the SAPUI5 SDK
Both test modules are opened through one HTML page, Test.qunit.html, that loads the test starter script
resources/sap/ui/test/starter/runTest.js, and a testsuite.qunit.js module that lists the tests by name. UI5 Tooling
serves the framework resources, so npx ui5 serve is the only server needed. To run them without a person looking at a
browser, the scratch run opened each test page in Chrome 157 in headless mode and read the result from the page. The
test page address has the form /test/Test.qunit.html?testsuite=test-resources/guide/expenses/testsuite.qunit&test=unit/Main.
The result block of QUnit contained:
unit/Main:
1 tests completed in 0 milliseconds, with 0 failed, 0 skipped, and 0 todo.
1 assertions of 1 passed. Main controller: adds amounts
integration/opaTests:
1 tests completed in 851 milliseconds, with 0 failed, 0 skipped, and 0 todo.
1 assertions of 1 passed. Main page: shows the Total button and lets the user press it
Source: real result block of the QUnit test page, read from headless Chrome 157.0.8103.51 against ui5 serve with OpenUI5 1.154.0 (the two lines of each test are shortened from the page’s HTML); the starter is described in the SAPUI5 SDK
Reading a result out of a page by hand is only a way to prove that the tests run. A pipeline normally uses a runner that turns the page result into an exit code. The SAP Continuous Integration and Delivery documentation names wdi5 (with Chromium version 114) as its supported testing tool for the Cloud Foundry scenario, and the wdi5 project describes itself as a WebdriverIO service that uses the UI5 test API. This page did not install or run wdi5, and it did not run the UI5 tests through a pipeline, so those steps are not run here.
ABAP: ABAP Unit and ATC in a pipeline
On the ABAP side the tests live in the system, in the same repository as the code, and the same two tools apply as in daily work. ABAP Unit runs the test classes of a package. ATC checks the code against a check variant, and its findings with priority 1 and 2 block the release of a transport request in the default setting of the ABAP environment; both are explained on the ABAP pages linked at the start. A pipeline simply calls them from outside instead of a developer pressing a key in ADT.
SAP Continuous Integration and Delivery has a predefined pipeline for this, called gCTS for ABAP Development. The documentation says the pipeline supports ABAP projects that use the Git-enabled Change and Transport System (gCTS), which manages ABAP change and transport processes with Git as the version-control system. It automates the steps of deploying ABAP content to a target ABAP system, running ABAP Unit tests, performing ABAP Test Cockpit checks, and rolling back to the previous commit if quality issues occur. The job form has an option to run ATC checks, with an extra option to roll the deployment back to the last successful commit if ATC finds errors, and an option to run ABAP unit tests. The job needs gCTS configured on the source and target ABAP system, a gCTS repository, and the SAP Cloud Connector for the connection to an on-premise system. The page Packages, Transports, gCTS and abapGit explains gCTS and abapGit.
This is a description only: it requires an SAP system; not run here.
Source: Configure a gCTS for ABAP Development Job (SAP Continuous Integration and Delivery documentation source on GitHub), Test in the ABAP Test Cockpit
Do not confuse this with abaplint, the open-source linter that the ABAP guide runs on a laptop without any SAP system; it checks the text of ABAP files and is the closest freely runnable analogue of ATC.
SAP Continuous Integration and Delivery
SAP Continuous Integration and Delivery is a service on SAP BTP that, in SAP’s words, lets you configure and run predefined pipelines that automatically build, test and deploy your code changes. It runs in the Cloud Foundry environment. Its features are to configure predefined pipelines, connect a Git repository, create and store credentials for private repositories, run the pipelines, and monitor the build status and logs. The documentation lists five use cases with their own predefined pipeline: Cloud Foundry Environment, SAP Fiori for the ABAP Platform, SAP Integration Suite Artifacts, Kyma Runtime and gCTS for ABAP Development. The supported Git hosts are GitHub, GitLab, Azure Repos, Bitbucket Server and Bitbucket Cloud.
Your own setup of a pipeline is called a job. You create the job in the service’s job editor: a unique name, the
repository and branch, the pipeline type, how long builds are kept (1 to 28 days, 1 to 99 builds), and the
configuration mode. In the mode Source Repository the stages live in a file in your Git repository. That file is
.sap_cid/config.yaml, in a folder named .sap_cid at the repository root. The service documentation lists the
supported build tools as the Cloud MTA Build Tool (parameter mta), npm and Maven, each with versions that name the
Node.js and Java release, for example MBTJ21N22 for MBT with Java 21 and Node 22, and it recommends the job editor
for configuring jobs, while allowing the repository file too. The next file is a minimal configuration for the
expenses lab project, written with the documented parameter names: build it with the MTA tool and run the project’s
test script as the additional unit test stage.
---
stages:
build:
buildTool: "mta"
buildToolVersion: "MBTJ21N22"
buildDescriptor: "mta.yaml"
additionalTests:
npmTests:
buildDescriptor: "package.json"
npmScript: "test"
Source: parameter names and structure from Configure a Cloud Foundry Environment Job in Your Repository; supported build tool versions in Supported Tools
The file is valid YAML (it was parsed in the scratch run) and it follows the documented parameters, but the service
itself was not used: it requires an SAP BTP account; not run here. The same documentation shows that the build stage
may also hold an npmLint section with failOnError, valid when the project has a lint configuration file, which the
lab project does not have, and that the pipeline needs a mta.yaml for the mta tool, which
CAP Deployment and MTA shows how to create.
The remaining stages of a Cloud Foundry job are optional. The malware scan stage has one switch, scan. The
acceptance stage deploys to a Cloud Foundry space (cfDeploy with apiEndpoint, org, space and a credential
name, and a strategy that is default or, for the MTA tool, blue-green) and can run an npm script of end-to-end
tests (webdriverIoTests with a baseUrl). The compliance stage runs a SonarQube or SonarCloud scan
(sonarScan). The release stage deploys again to the production space and, for the MTA tool, can export the archive
to a node of the Cloud Transport Management service (cloudTransportManagement). That link to transports is how a
Git-based pipeline meets the transport process described in
Transports and Change Management. Credentials never go into the
file: the service stores them and the file refers to them by name.
Source: What Is SAP Continuous Integration and Delivery and Configure a Cloud Foundry Environment Job in Your Repository (SAP Continuous Integration and Delivery documentation source on GitHub); the product documentation is at What Are Continuous Integration and Continuous Delivery?
Project "Piper"
Before and beside the service, SAP offers Project "Piper", an open-source project. Its repository describes it as
offering default pipelines that implement CI/CD processes integrating SAP systems, with a shared library of steps for
building your own scenarios beyond the defaults. The project site describes tooling that consists of predefined
pipelines, a shared library, a command line utility and Docker images, built around Jenkins pipelines as code, with
the command line utility also available as a GitHub Action. Piper reads its settings from the file
.pipeline/config.yml in the repository root, with the top-level keys general and steps, and a Jenkins pipeline is a
Jenkinsfile that loads the library and calls steps by name. The guided tour of the project builds a pipeline with
three stages, prepare, build and deploy, that call the steps setupCommonPipelineEnvironment, mtaBuild and
cloudFoundryDeploy; the configuration file sets buildTarget: 'CF' for mtaBuild and, for cloudFoundryDeploy, the
deploy tool, deploy type, organization, space and a credentials identifier.
@Library('piper-lib-os') _
node() {
stage('prepare') {
checkout scm
setupCommonPipelineEnvironment script: this
}
stage('build') {
mtaBuild script: this
}
stage('deploy') {
cloudFoundryDeploy script: this
}
}
Source: the structure of the Jenkinsfile in Project "Piper": Guided Tour, rewritten from the page’s description of its stages and steps
This requires a Jenkins server and an SAP BTP account: not run here.
The status of the project matters for a decision today. The README of the SAP/jenkins-library repository carries an
archive notice: the repository will be archived on December 31, 2026, will receive only critical maintenance until
then, and becomes read-only on January 1, 2027, with SAP internal teams unaffected and external users asked to contact
their SAP representative about alternatives. The project site marks a part of its steps with the heading Library Steps
(deprecated). A team that starts a new pipeline today should therefore prefer the SAP Continuous Integration and
Delivery service, or a pipeline of its own on a general CI server that calls npm test, ui5lint and mbt build
directly, and treat Piper only as the model that many existing SAP pipelines were written with.
Source: SAP/jenkins-library README (archive notice) and Project "Piper" site
Git workflows for UI applications
Every pipeline above starts from Git, so the workflow around Git matters as much as the tools. The usual practice for a UI application is short: each change is made on its own branch, pushed, reviewed in a pull request, and merged only when the pipeline for that branch is green; the main branch is the one that is released. SAP Continuous Integration and Delivery supports this directly. The job for a repository is tied to a branch, a job can also be configured for several branches (the documentation has a page on multi-branch jobs), and the service is told about a push by a webhook that you add in your Git host; the documentation has a separate page for GitHub, GitLab, Bitbucket Server, Bitbucket Cloud and Azure Repos. A job for a private repository uses a stored credential to read the code.
The same idea applies to ABAP once the code lives in Git through gCTS or abapGit: a branch maps to a repository in the ABAP system, and the pipeline deploys that branch to a test system and runs ABAP Unit and ATC there.
Source: Supported Tools and the webhook pages of the SAP Continuous Integration and Delivery documentation source
Where books and older tutorials differ
The SAP PRESS book on the ABAP RESTful programming model (Haas and Mathew, 1st edition 2019) closes with chapters on version control with Git, automated testing and continuous integration. The ideas are still right: keep the code in Git, test at several layers, and run the tests automatically. What the book shows and what changed:
-
The tools around Git. The book works through Git in SAP Web IDE. Current SAP development tools run in SAP Business Application Studio and in Visual Studio Code. SAP describes SAP Business Application Studio as based on Code - OSS, the open source behind Visual Studio Code.
-
Backend tests. The book covers ABAP Unit and the CDS Test Double Framework. Both still exist; the page ABAP Unit and Test Doubles covers them for the current release.
-
Front-end tests. The book covers QUnit and OPA5, which still ship in OpenUI5 1.154.0 as shown above, and an end-to-end test with Nightwatch.js. The SAP Continuous Integration and Delivery documentation names wdi5, not Nightwatch.js, as the supported end-to-end tool of its Cloud Foundry pipeline.
-
The pipeline. The book builds the pipeline on a local Jenkins server with a hand-written
Jenkinsfile. Today SAP offers a hosted service with a configuration file in the repository, and Project Piper, the library behind many Jenkins pipelines, is announced to be archived at the end of 2026.
Source: ABAP RESTful Programming Model, SAP PRESS (publisher page; the copy consulted is the 1st edition), What Is SAP Business Application Studio?
What can go wrong
| Symptom | Likely cause | What to check |
|---|---|---|
|
The linter is not a command of UI5 Tooling 4.0.73 |
Install |
|
Manifest version 2 removes properties such as |
Run |
|
The UI5 libraries are listed in |
List the framework libraries only in |
|
|
Call it once per file and avoid fake timers |
Draft handler tests return 200 where 400 is expected |
The handler runs on |
Create the draft, then call |
Test pages open but nothing runs in the pipeline |
A pipeline needs an exit code, not a page |
Use a runner such as wdi5 that reports an exit code |
The SAP Continuous Integration and Delivery job fails on build |
|
Commit both; |
Credentials appear in the job file |
A password was pasted into |
Store the credential in the service and refer to it by name |
A Piper step is missing in a new library version |
The step is marked deprecated or the repository is archived |
Check the Piper site, or move the stage to the SAP service or your own CI |
Source: the real runs on this page and Configure a Cloud Foundry Environment Job in Your Repository
Summary
-
Tests come in layers: static checks, service tests, UI unit tests, UI integration tests, end-to-end tests and ABAP Unit. A pipeline runs them in a fixed order after every push and stops when one fails.
-
A CAP service is tested with
cds.test, which starts the service inside the test and gives itGETandPOST;cds testornode --testruns it and returns a non-zero exit code on failure, and Node can enforce a coverage minimum. -
SAPUI5 is checked with
npx ui5lint(notui5 lint), tested with QUnit and OPA5, which run in a browser page, and end to end with wdi5, which the SAP service names as its supported tool. -
ABAP uses ABAP Unit and ATC, and the gCTS for ABAP Development pipeline of SAP Continuous Integration and Delivery runs both and can roll back a deployment.
-
SAP Continuous Integration and Delivery runs predefined pipelines for Git repositories, configured in a job and in
.sap_cid/config.yaml; Project "Piper" uses.pipeline/config.ymland a Jenkinsfile, and its repository is announced to be archived on December 31, 2026. -
The pipeline steps that need an SAP BTP account, a Jenkins server or an ABAP system were described, not run.
Try it
To do this by hand, follow the guide Test a CAP Service and a UI5 App: it tests a CAP service and a UI5 app locally, as a CI pipeline would.