Testing

Proving the service still does what it did — against the model and the handlers, without a deployed system and without a database somebody has to keep clean.

Overview

SAP SHIPSby design
Node.js →

@cap-js/cds-test Test support for CAP Node.js, installed as a dev dependency: it starts the project's server for the test, hands the test an HTTP client bound to it, and carries the assertions.

Java →

com.sap.cds:cds-services-bom Test support for the three layers the guide names: event handlers in isolation, services dispatching to them, and the application through its API with Spring Boot test support.

Not covered: At the service boundary. Driving a UI, running a scenario in a browser, and anything needing a real BTP binding are outside it, and that is where every other entry here sits.

Sourcecds.test — capirechecked

Artifacts7

7 of 7 artifacts
ArtifactSignals
CDS plugins2
cds-cucumberGherkin scenarios driving a running CAP service
Signals
none
cds-launchpad-pluginSandbox launchpad for all SAPUI5 apps in a CAP workspace
Signals
none
CLI tools2
sapbrunoTerminal UI running Bruno collections against a CAP service
Signals
none
enforce-export-coverageGeneralStatic check that each exported TypeScript function has a test
Signals
Functional boundary
Packages3
@cap-js/cds-testTest support for CAP Node.js: server start, HTTP client, assertions
Signals
none
@sap-ux/fe-mockserver-plugin-cdsFiori Elements mock server plugin taking a CDS file as metadata
Signals
none
com.sap.cds:cds-services-bomMaven bill of materials pinning CAP Java module versions
Signals
none

Content8

Group by8 of 8 pieces
Piece, what it offers
How to Restrict CRUD Operations in SAP CAPM Using @Capabilities, @readonly and Test APIs with .http
SAP Community, DeepaRagho, BlogThe reasoningA recipeRunnable code
Enhancing Unit Testing in SAP CAP Java Applications with GitHub Copilot
SAP Community, Anjali_Pathak, BlogThe reasoning
Getting Started with Unit Testing in SAP CAP Java Applications
SAP Community, Anjali_Pathak, BlogThe reasoningRunnable code
Core changed
Show 5 more
CAP full-stack testing with BDD flavour
SAP Community, Vladislav Leonkev, Blog
Testing your CAP HANA Artifacts with jest – including multitenancy, hdbprocedure and hdbview
SAP Community, Tristan, BlogThe reasoningA recipeRunnable code
Core changed
CAP: Unit Testing using Mocha and Chai
SAP Community, jhodel18, BlogThe reasoningRunnable code
Core changed
Integration Tests in a Cloud Foundry Java App using SAP Cloud Application Programming Model
SAP Community, former_member428487, BlogThe reasoningRunnable code
Core changed
Create Automated System Tests for SAP Cloud Application Programming Model Projects
SAP Developer Center, SAP, TutorialThe reasoningA recipe
CAP full-stack testing with BDD flavour
SAP Community, Vladislav Leonkev, Blog

Seen working2

ArtifactSignals
Samples2
cap-java-snippetsTen short CAP Java references, one document per topic
none
SAP-samples/cap-bookshop-wdi5CAP bookshop with wdi5 system tests for a CI/CD tutorial
none

Details

What changed — and what it makes stale3
@cap-js/cds-test 1.0.0, CAP

Through its 0.x releases, cds.test's HTTP shortcuts (GET, PUT, POST…) ran on axios. Version 1.0 dropped that dependency in favour of Node's native Fetch API across the package — cds.test.axios remains only as a deprecated, partial fallback — and moved the default assertion library to Chai 6 while adding Vitest as a fully supported test runner alongside Jest, Mocha and node:test.

Makes stale:

Any description of cds.test as axios-backed, or troubleshooting written around cds.test.axios as the primary HTTP client — since 1.0 that path is deprecated, not the default.

@sap/cds 9.0.2, CAP, Node.js

@cap-js/cds-test stopped being optional: cds.test now refuses to run unless the package is installed, and the axios, chai, chai-as-promised and chai-subset dependencies a project used to add by hand are no longer needed once it is. The 9.0 line reached npm as 9.0.2 on 2025-06-02 — 9.0.0 and 9.0.1 were never published.

Makes stale:

Setup steps that install axios, chai, chai-as-promised and chai-subset directly to use cds.test rather than adding @cap-js/cds-test. On cds9, cds.test does not run without the latter present, regardless of what else is installed.

SourceCAP changelog 2025 — cds@9.0.0checked
@cap-js/cds-test 0.1.0, CAP

Before this, cds.test shipped inside @sap/cds itself, and a project pulled in axios, chai, chai-as-promised and chai-subset separately to use it. Test support moved out into its own package, @cap-js/cds-test, installed as a devDependency and versioned on its own release cycle from here on.

Makes stale:

Guidance that treats cds.test as something @sap/cds provides with no extra install — from this point a project needs @cap-js/cds-test as a devDependency to get it.

Coverage
statecore and community, CAP
assessed
relationshipnarrow by design
Sourcecds.test — capirechecked SourceTesting Applications (CAP Java) — capirechecked SourceTesting Applications (CAP Java) — capirechecked
For your agent