Lesson 1 of 5
Why test below the UI
10 min
Listen to this lesson
A Fiori screen, an SAP GUI transaction and an external system calling an API all end up in the same place: the business logic and database of SAP S/4HANA. When the question a test asks is "does the system price, check and post this correctly?", the user interface is often just the slowest and most fragile way to ask it. Tests that talk to services directly run in seconds, do not care about themes or screen layouts, and give precise answers. This course shows how to build them for the three interface styles you will meet in almost every SAP landscape: OData, SOAP and IDoc.
What you gain
- Speed: an OData call that creates a sales order returns in a second or two; the same flow through a UI script takes far longer with logon, navigation and rendering.
- Stability: no locators, no rendering waits, no theme or layout changes. Service contracts change far less often than screens, and released APIs are versioned.
- Precision: the response tells you exactly which field, message class or status went wrong, instead of a screenshot of a red message bar.
- Coverage of interfaces themselves: for integrations (EDI orders, bank files, a dealer portal) the service is the user. Testing it through a UI would test the wrong thing.
What you give up
Service tests do not prove that a user can do the job. They skip the launchpad, role content, field labels, value helps, draft handling and messages on screen. They also skip whatever logic lives only in the UI layer, such as client-side validations in a custom app. And they can give false comfort when the API a test calls is not the one users or interfaces use: a test that creates sales orders through a released API proves little about an inbound EDI channel that uses IDocs and different defaulting.
| Risk to cover | Best layer | Why |
|---|---|---|
| Pricing and tax for 40 customer and product combinations | API test | Many data variants; screen adds nothing |
| EDI order from Great Lakes Fleet Services posts correctly | IDoc test | The IDoc is the real channel |
| Maria can find, change and save an order in Manage Sales Orders | UI test | The user path is the point |
| Role SD key user cannot release a credit-blocked order | API plus one UI check | Authorization is enforced in the back end; confirm the UI hides the action |
| Month-end posting of 2,000 journal entries from the fleet billing system | SOAP or API test | Volume and contract, not screens |
Assert on business outcomes
The most common weakness in service tests is stopping at "HTTP 201 Created" or "IDoc arrived". A technical success code says the request was accepted, not that the business result is right. Every service test at Contoso ends with a business assertion: the order has the expected net value and status, the IDoc reached a posted status and the sales order exists with the right quantities, the journal entry balances in company code 1710 with the right G/L accounts. This is the same rule as for any SAP test: expected results are written before execution and checked against the documents.
What would you do?
Grace asks whether the new API tests mean the team can drop all UI regression for order-to-cash. What should Priya answer?
- Service tests reach the same business logic as the UI, faster, more stably and more precisely.
- They skip the user path, roles and UI-only logic, so keep a smaller set of UI tests.
- Test integrations through their real channel: IDoc for IDoc, SOAP for SOAP.
- Never stop at a technical success code; assert on the business document.
Check your understanding · not graded
Lesson check
1. What does a service-level test typically skip compared with a UI test?
2. An EDI customer sends orders as IDocs. What is the right channel for the automated regression test?
3. Which assertion makes an API test a real business test?
4. Pricing must be checked for 40 customer and product combinations. Which layer fits best, and why?