PackagePackagetypeA library you install and call yourself.See every one →What this type is →independently maintainedindependently maintainedoriginPublished by one person or a small company outside SAP. Says nothing about quality; the readings say that.See every one →

assert

A 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.

assert(x)->equals(y) replaces the more verbose cl_abap_unit_assert=>assert_equals(act = ... exp = ...) call, once a test class inherits from the library's ZCL_ASSERTABLE_UNIT base class. The same fluent object works outside unit tests too, through a ZCL_ASSERTABLE class or an assert interface implemented directly in another class, and a resumable exception lets a caught assertion failure be fixed and resumed rather than always failing the caller.

Facts

Latestv2.1.0ReleasedLast pushLicenceMIT

Where it sits

Lives in
Provides
Unit testingABAPUnit testingcapabilityTesting application logic without a running business process — and the test doubles that make dependencies on the database and on framework services tractable.

Who is behind it

abapifyabapifyOrganisationMaintains this
In the atlas: maintains 9
@abapify
maintainerLars HvamPersonContributes to this
In the atlas: maintains 13, contributes to 92, wrote 1
@larshp
Petr PlenkovPersonContributes to this
In the atlas: contributes to 13
@ThePlenkov
2 contributors

What it declares

Every artifact

Type
Package
Origin
Independently maintained

As a package

Where it runs
Inside its host
Distributed through
does not say

Connections2

README

quoted from abapify/assert under MIT, read
abapify/assert/README.mdOn GitHub

Assert library

In the beginning this project contained class ZCL_ASSERT. We had to rename it becase the class was already reserved in dotabap registry.

Following official documentation we're supposed to write unit tests using following template

cl_abap_unit_assert=>assert_equals( act = myclass=>text
                                    exp = 'X' ).

The only function this library delivers - it allows us to use shorter construction like this:

assert( myclass=>text )->equals( 'X' ).

Usage in unit tests

To use this library you need to use ZCL_ASSERTABLE_UNIT class as a base class for your test class.

CLASS ltcl_main DEFINITION INHERITING FROM zcl_assertable_unit
    FINAL FOR TESTING
  DURATION SHORT
  RISK LEVEL HARMLESS.
...
endclass.

then later in your code you can just use something like:

    assert( 1 )->not_initial( ).
    assert( 1 )->eq( 1 ).
    assert( 1 )->ne( 2 ).
    assert( new ltcl_main( ) )->bound( ).
    assert( not_bound )->not_bound( ).
    assert( abap_true )->true( ).
    assert( abap_false )->false( ).

Working with references

You might have a reference pointing to the value and you would like to compare not the reference but the value it refers to. Instead of dereferencing in your using test you can write something like:

assert( data_reference )->ref( )->equals( 'Some value' ).

Please notice that it expects that actual value is a data refence and will throw an error if it's not.

Local asserts

It might be helpful to use assert interface in a normal runtime, not only in unit tests.

data(assert) = new zcl_assertable( ).
assert->assert( 1 )->not_initial( ).

or if your class is inherited from ZCL_ASSERTABLE then simply like this

assert( 1 )->not_initial( ).

alternatively you can implement zif_assert interface right in your class:

class zcl_your_class definition.
  public section.
    interfaces zif_assertable.
  private section.
    aliases assert for zif_assertable~assert.
    methods some_method.
endclass.
class zcl_your_class implementation.
  method zif_assertable~assert.
    result = new zcl_assertable( actual = actual ).
  endmethod.
  method some_method.
    assert( some_value )->eq( another_value ).
  endmethod.
endclass.

PLease notice in this case if zif_assertable interface will be extended ( with methods/parameters ) you will have to support this change too in your class.

Exception handling in local mode

One more feature which local asserts bring is a resumable exception. For example you can assert and catch assertion exception (which native asserts do not support BTW).

try.
  assert( ref )->is_bound( ).
catch zcx_assertable.
  " some exception handling
endtry.

Since ZCX_ASSERTABLE is a no-check exception you can bring it higher and do even more advanced logic

method main.
  try.
    do_something( ref ).
  catch before unwind zcx_assertable.
    " fix the problem here
    ref = new #( ).
    resume.
  endtry.
endmethod.

method do_something.
  assert( ref )->is_bound( ).
endmethod.
MIT, read

History

Latest

v2.1.0

  1. v1.5.1

  2. v2.0.0

  3. v1.5.0

  4. v1.4.1

  5. v1.4.0

  6. v1.3.0

  7. v1.2.0

  8. v1.1.2

  9. v1.1.1

  10. v1.1.0

  11. v1.0.3

  12. v1.0.2

  13. v1.0.1

  14. v1.0.0

  15. v0.4.9

On npm
10,018,806downloads per week, npm
Weekly downloads for assert26 complete calendar weeks from 2026-04-20 to 2026-10-18; the latest total is 10018806.20 Apr – 26 Apr: 16,626,01727 Apr – 3 May: 16,785,8884 May – 10 May: 16,926,27111 May – 17 May: 17,888,37118 May – 24 May: 17,444,18525 May – 31 May: 16,690,6561 Jun – 7 Jun: 15,235,8458 Jun – 14 Jun: 18,618,32915 Jun – 21 Jun: 18,693,05122 Jun – 28 Jun: 18,072,88629 Jun – 5 Jul: 16,547,7276 Jul – 12 Jul: 16,482,33213 Jul – 19 Jul: 17,843,51820 Jul – 26 Jul: 18,047,49327 Jul – 2 Aug: 18,399,7593 Aug – 9 Aug: 18,108,38810 Aug – 16 Aug: 15,830,99517 Aug – 23 Aug: 18,756,17424 Aug – 30 Aug: 18,955,93231 Aug – 6 Sept: 16,104,6427 Sept – 13 Sept: 12,963,43914 Sept – 20 Sept: 19,007,92121 Sept – 27 Sept: 21,392,08928 Sept – 4 Oct: 21,455,3805 Oct – 11 Oct: 14,608,79612 Oct – 18 Oct: 10,018,806
Declared alternative
  1. abap-senchaBDD/TDD assertion library for ABAP Unit, styled after Chai.js
Unit testing
  1. abap2UI5 headless frontendDrives abap2UI5 app classes from ABAP Unit tests
  2. @abap2ui5/mcp-serverMCP server for the abap2UI5 check, deploy and run loop
  3. @abaplint/transpilerTranspiles ABAP to JavaScript to run on Node.js
  4. Modernization Agents for SAP on AWSAWS agents for ABAP, PI/PO and BW modernisation work
  5. abap_db_preparatorReplays stored database snapshots in ABAP unit tests
  6. cacamber-BDD-for-ABAPBDD framework turning Given/When/Then into ABAP Unit steps
  7. abap-utesthelpHelper classes for ABAP Unit tests and test doubles
  8. regression_testSnapshot testing library for ABAP, from debugger or unit test
  9. abapCovUploads ABAP Unit code coverage to codecov.io
  10. ABAP remote filesystemVS Code extension editing ABAP systems over ADT as a filesystem
  11. open-steamgateLocal ABAP server serving /IWBEP/ OData v2 without an SAP system
  12. express-icf-shimShim running an ABAP ICF handler behind an Express 4.x server
  13. open-abap-coreCore ABAP artifacts for code transpiled by @abaplint/transpiler
  14. mockup_loaderLoader of Excel-prepared ABAP unit test data, with stub generation
  15. mockAA free mocking framework for ABAP, published under the Apache License 2.0.
  16. Vise_for_ABAPA characterisation-test helper: `ZCL_VISE=>GRIP` records a field's value once and fails a later run if it has changed.
  17. abap-senchaBDD/TDD assertion library for ABAP Unit, styled after Chai.js
  18. abap-test-containerGitHub-hosted test data container for ABAP Cloud
  19. abap-unit-runnerApplication job that runs and schedules ABAP Unit tests in the cloud
  20. adash-servicesBackend exposing ABAP Unit runs and coverage over REST and OData

Details

Sources3
Added by handdiscovered herechecked
github.com/git+https://github.com/browserify/commonjs-assert.gittree, pushes, contributors, CIchecked
README.mdquoted, and what the entry declareschecked

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
latestv2.1.0
first release
releases and cadence16, ~115d median
discovered viaAdded by hand
first seen in the atlas
ecosystem and domainabap, developer-experience
abaplint
issues under its own abaplint configuration0
lines430
statements275
objects8
files17
analysed, main
abaplint version2.120.84
Contributors2

From the repository’s contributor list, .

History in the atlas1
  1. First seen.
For your agent
Ref
artifact:abapify-assert
JSON
/artifacts/abapify-assert.json
MCP
Connecting an agent