abap-utesthelp
Two helper classes for ABAP Unit tests: one verifies a domain constant class against its domain's fixed values, the other creates test doubles without naming the interface.
A domain constant class contains constants for each value of a domain, and ZCL_UTESTHELP_DOMCONSTANT_TEST is the parent class for the unit test that checks one against its domain. Its test methods verify that every constant is found in the domain's fixed values, that every fixed value has a constant, that no value repeats, that the class is abstract and that all constants have the same type. A subclass only implements GET_CLASS_NAME, and DETERMINE_CLASS_NAME_FROM_TYPE fills that in dynamically rather than hard-coding the name. The second class, ZCL_UTESTHELP_TEST_DOUBLE_UTIL, wraps the standard test double framework CL_ABAP_TESTDOUBLE: its CREATE_TEST_DOUBLE builds a double from an existing reference variable instead of the interface or class name passed in as a string, so an object can be renamed without adjusting the names in the tests.
Facts
Where it sits
Who is behind it
In the atlas: maintains 1@endresshauser-infoservemaintainerConjuringCoffeeContributes to this
In the atlas: contributes to 7@ConjuringCoffee1 contributor
What it declares
Every artifact
- Type
- Package
- Origin
- Independently maintained
As a package
- Where it runs
- Inside its host
- Distributed through
- does not say
Connections
Testing application logic, with test doubles for its dependencies
Open, versioned style guide for ABAP
Download
README
quoted from endresshauser-infoserve/abap-utesthelp under MIT, readUTESTHELP - Unit test helpers
This repository contains helpful classes for your unit tests.
Test class for domain constant classes
You can use class ZCL_UTESTHELP_DOMCONSTANT_TEST as a parent class for your domain constant class unit tests.
It has test methods to verify the integrity of your constant class:
- Verify all constants are found in the domain fix values
- Verify each domain fix value has a constant
- Verify the constant values do not repeat
- Verify the class is abstract
- Verify all constants have the same type
What's a domain constant class?
A domain constant class contains constants for each value of a domain.
Please refer to the approriate section in the Clean ABAP styleguide for more details on the subject.
A constant class for the domain DDISGN might look like this:
CLASS zcl_ddsign_constant_class DEFINITION
PUBLIC
FINAL
ABSTRACT
CREATE PUBLIC.
PUBLIC SECTION.
CONSTANTS included TYPE ddsign VALUE 'I'.
CONSTANTS excluded TYPE ddsign VALUE 'E'.
ENDCLASS.
How to use
Simply inherit your test class from this class and implement method GET_CLASS_NAME.
You can use method DETERMINE_CLASS_NAME_FROM_TYPE to do this dynamically without hard-coding the name of the class:
CLASS ltc_example_inheritor DEFINITION CREATE PUBLIC
FOR TESTING
RISK LEVEL HARMLESS
DURATION SHORT
INHERITING FROM zcl_utesthelp_domconstant_test.
PROTECTED SECTION.
METHODS get_class_name REDEFINITION.
ENDCLASS.
CLASS ltc_example_inheritor IMPLEMENTATION.
METHOD get_class_name.
DATA lo_constant_class TYPE REF TO lcl_example_constant_class.
rv_result = determine_class_name_from_type( lo_constant_class ).
ENDMETHOD.
ENDCLASS.
Credit
ZCL_UTESTHELP_DOMCONSTANT_TEST was inspired by an example from the Clean ABAP styleguide.
Test double utility class
Class ZCL_UTESTHELP_TEST_DOUBLE_UTIL offers reusable functionality for the standard test double framework (CL_ABAP_TESTDOUBLE).
Method CREATE_TEST_DOUBLE can be used to create a test double without explicitly passing in the name of the required interface or class.
This allows you to rename your objects without having to manually adjust the object names in the tests.
Example:
DATA lo_double TYPE REF TO zif_example.
lo_double ?= zcl_utesthelp_test_double_util=>create_test_double( lo_double ).
Instead of this:
DATA lo_double TYPE REF TO zif_example.
lo_double ?= cl_abap_testdouble=>create( 'zif_example' ).
Contributing
If you want to contribute to this repository, please use this ABAP Cleaner Profile. Pull requests are welcome.
History
Notes
This release changes the domain name resolution of ZCL_UTESTHELP_DOMCONSTANT_TEST. Before, the name of the constant's data element was used as the domain name. As a result, the code only worked by coincidence when the data element and domain shared the same name. Now, the domain name is correctly determined.
Notes
This release only fixes some harmless syntax warnings. There are no changes to actual logic.
Notes
This release adds the license information to the classes. There are no changes to actual logic.
Notes
This release adjusts the license and various texts to the new repository owner. There are no changes to actual logic.
Notes
The first version of the repository to provide the domain constants test and the test double util.
Others providing
Compare all 21 on the Unit testing page →- abap2UI5 headless frontendabap2UI5 headless frontendPlays the frontend's side of the abap2UI5 request/response contract in ABAP, so an app class is driven and asserted on from a plain ABAP Unit test.community org, abapDrives abap2UI5 app classes from ABAP Unit tests
- @abap2ui5/mcp-server@abap2ui5/mcp-serverAn MCP server that puts the abap2UI5 development loop on the machine an agent runs on: check the view the ABAP builds, photograph it, deploy the class into a sandbox, boot the app headless and read the errors.community org, abapMCP server for the abap2UI5 check, deploy and run loop
- assertassertA fluent assertion helper for ABAP Unit tests that wraps cl_abap_unit_assert in chained calls such as assert(x)->equals(y), also usable outside tests through ZCL_ASSERTABLE.independent, abapFluent assertion helper for ABAP Unit tests
- @abaplint/transpiler@abaplint/transpilerTranspiles ABAP 7.02 syntax to ES6 JavaScript, so ABAP code and its unit tests run on Node.js in CI without an ABAP system, with optional SQLite, PostgreSQL, Snowflake or SAP HANA drivers.community org, abapTranspiles ABAP to JavaScript to run on Node.js
- Modernization Agents for SAP on AWSModernization Agents for SAP on AWSAWS's suite of agents for SAP modernisation work: custom ABAP converted for S/4HANA, PI/PO interfaces moved to Integration Suite, BW objects moved to SAP Datasphere, deployed into a customer's own AWS account and reached only after registration.partner, abapAWS agents for ABAP, PI/PO and BW modernisation work
- abap_db_preparatorabap_db_preparatorA wrapper over ABAP's OpenSQL replacement service that exports chosen rows into a stored bundle and, in a unit test's setup, replays it as fake table content in two method calls.independent, abapReplays stored database snapshots in ABAP unit tests
- cacamber-BDD-for-ABAPcacamber-BDD-for-ABAPA BDD framework for ABAP that turns Gherkin-style Given/When/Then scenarios into ABAP Unit test steps, matching each step against a regular expression and calling the test class method it maps to.independent, abapBDD framework turning Given/When/Then into ABAP Unit steps
- regression_testregression_testA snapshot library for ABAP that records a value once and compares against it on every later run, from either the debugger or a unit test, storing snapshots in eCATT test data containers.independent, abapSnapshot testing library for ABAP, from debugger or unit test
- abapCovabapCovA report, ZABAPCOV, that uploads ABAP Unit test code coverage results to codecov.io, once the repository is installed through abapGit and codecov.io's certificates through STRUST.independent, abapUploads ABAP Unit code coverage to codecov.io
- ABAP remote filesystemABAP remote filesystemA Visual Studio Code extension that opens an ABAP system over ADT as an editable filesystem and exposes system tools to GitHub Copilot and external MCP clients.independent, abapVS Code extension editing ABAP systems over ADT as a filesystem
- open-steamgateopen-steamgateAn ABAP application server you clone and run on your own machine: transpiled ABAP serving classic /IWBEP/ OData v2 to Fiori over a local database, with no SAP system attached.independent, abapLocal ABAP server serving /IWBEP/ OData v2 without an SAP system
- express-icf-shimexpress-icf-shimA shim that runs an ABAP ICF handler written against if_http_extension behind an Express 4.x server, for ABAP transpiled to JavaScript and run on Node.js in testing and continuous integration.community org, abapShim running an ABAP ICF handler behind an Express 4.x server
- open-abap-coreopen-abap-coreReusable ABAP functionality for code transpiled by @abaplint/transpiler: the core ABAP artifacts that code runs against on Node.js.community org, abapCore ABAP artifacts for code transpiled by @abaplint/transpiler
- mockup_loadermockup_loaderA tool that loads ABAP unit test data prepared in Excel as TAB-delimited text into ABAP structures and tables, and generates interface stubs that return that mock data.independent, abapLoader of Excel-prepared ABAP unit test data, with stub generation
- mockAmockAA free mocking framework for ABAP, published under the Apache License 2.0.independent, abapA free mocking framework for ABAP, published under the Apache License 2.0.
- Vise_for_ABAPVise_for_ABAPA characterisation-test helper: ZCL_VISE=>GRIP records a field's value once and fails a later run if it has changed.independent, abapA characterisation-test helper: `ZCL_VISE=>GRIP` records a field's value once and fails a later run if it has changed.
- abap-senchaabap-senchaA BDD/TDD assertion library for ABAP Unit, styled after the JavaScript library Chai.js, that wraps cl_abap_unit_assert in chainable expect, should and assert styles.independent, abapBDD/TDD assertion library for ABAP Unit, styled after Chai.js
- abap-test-containerabap-test-containerA test data container for ABAP Cloud that loads unit test data in JSON, XML or raw formats from GitHub and maps it onto the target structure, filling the platform's missing native one.independent, abapGitHub-hosted test data container for ABAP Cloud
- abap-unit-runnerabap-unit-runnerAn application job that runs and schedules ABAP Unit tests in SAP's ABAP Environment through the SAP_COM_0735 API, where the on-premise test runner has no SAP GUI to run from.independent, abapApplication job that runs and schedules ABAP Unit tests in the cloud
- adash-servicesadash-servicesThe backend service behind ADASH Cli, exposing ABAP Unit test runs and coverage as REST and OData services for CI/CD pipelines, with a report scheduled to run tests per package.independent, abapBackend exposing ABAP Unit runs and coverage over REST and OData
Details
Sources
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
abaplint
Contributors
History in the atlas
- First seen.
For your agent
- Ref
artifact:endresshauser-infoserve-abap-utesthelp- JSON
- /artifacts/endresshauser-infoserve-abap-utesthelp.json
- MCP
- Connecting an agent