Now accepting guest editorial from SAP, Oracle, Workday and ServiceNow practitioners.Pitch a guide
The Sign-Off Table

Lesson 5 of 5

Fiori elements preview and testing RAP behavior

9 min

Listen to this lesson

0:00 / 8:57

With the binding published, Kenji opens the Fiori elements preview from the binding editor and sees a list report of agreements and an object page with items, driven entirely by the UI annotations in the projection's metadata extension. The preview is the developer's first end-to-end check. It is not a test strategy. SAP's RAP testing guide makes the case plainly: manual regression testing is slow and error-prone, so RAP apps need automated tests tailored to each artifact type, on more than one test level.

Business acceptanceMaria’s team in CMQ with realistic agreements and roles
OData integration testsCall the service through an OData client proxy; whole stack including projection
EML integration testsCreate, modify and commit through EML; determinations and validations run together
Unit testsOne handler method at a time, dependencies replaced by test doubles
CDS unit testsView logic with the CDS test double framework
Test levels for a RAP app, from the most isolated to the most realistic.
The Sign-Off Table · thesignofftable.com/academy/sap-abp-202

Unit tests for behavior

SAP's RAP guide describes unit tests for behavior implementations such as validations, determinations and actions, using the RAP BO test double framework to isolate the BO's dependencies. SAP's ABAP Unit cheat sheet names two variants: a transactional buffer test double (class CL_BOTD_TXBUFDBL_BO_TEST_ENV), which replaces the BO's buffer with one you fill with test instances, and a mock of the EML API (class CL_BOTD_MOCKEMLAPI_BO_TEST_ENV), which lets you configure what EML calls return. For a validation such as validateDates, a test inserts two agreements into the double, one valid and one with ValidTo before ValidFrom, calls the handler and asserts that only the second appears in failed and reported.

  1. class_setupCreate the RAP BO test environment for ZR_CMC_CoreAgreement
  2. setupClear the doubles; create the handler under test
  3. ArrangePut a valid and an invalid agreement into the transactional buffer double
  4. ActCall validateDates with both keys
  5. Assertfailed holds only the invalid key; reported has a message on ValidTo
  6. class_teardownDestroy the environment
A unit test for one validation, step by step.
The Sign-Off Table · thesignofftable.com/academy/sap-abp-202

Integration tests

Unit tests prove each rule alone. SAP's ABAP Cloud guide adds integration tests: with EML, a test creates an agreement with items, calls COMMIT ENTITIES and checks that determinations and validations worked together; with the OData client proxy, a test sends requests through the service so the projection, the projection BDEF and the binding are covered too. Integration tests touch the database, so they create their own data and clean up after themselves, and they run fewer cases than unit tests.

An EML integration test creates its own data, commits so determinations and validations run together, asserts the result and cleans up.
The Sign-Off Table · thesignofftable.com/academy/sap-abp-202

Two practical habits make these tests last. First, keep test data in the test: a handful of agreements for Great Lakes Fleet Services with known dates and deposits, created by the test itself, rather than records someone keyed into CMD months ago. Second, run the tests where the gate runs. When Kenji's team includes the BO's packages in the unit test and ATC runs attached to each transport, a later change to a determination that breaks TotalDeposit is caught in CMD, not in Mock 2 or, worse, by Dan at month-end.

What to proveBest levelContoso example
A single ruleUnit test with RAP BO test doublevalidateDeposit rejects 0 for CMC-ALT-100
Rules working together on saveEML integration testCreate, add two items, commit: TotalDeposit correct
What the service exposesOData integration testDelete is not offered; closeAgreement is
Usability and fitBusiness acceptance in CMQMaria’s team maintains real agreements
Who may do whatRole-based tests in CMQWave 2 users cannot change 1710 agreements

Matching each question to the cheapest test level that answers it.

What would you do?

Priya proposes that Maria's team test every validation through the Fiori app in CMQ, because "that is how users will see it". Kenji suggests a different split. Which split is best?

Key points
  • The Fiori elements preview is a developer check, not a test strategy.
  • Unit-test handlers with the RAP BO test double framework (transactional buffer double or EML API mock).
  • EML integration tests prove rules working together through COMMIT ENTITIES.
  • OData integration tests cover the projection, projection BDEF and binding.
  • Business acceptance proves fitness for use; it should not be the first place a rule is tested.

Check your understanding · not graded

Lesson check

  1. 1. Which class creates a transactional buffer test double for a RAP BO?

  2. 2. Which test type also covers the projection, projection BDEF and binding?

  3. 3. What is the Fiori elements preview best used for?

  4. 4. Which EML statement makes an integration test persist its changes?