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 →

abap-odata-test

An ABAP client library for calling OData services and chaining assertions on the response, such as assert_http_200, for unit tests, ADT console runs and standalone programs; its examples show GET only.

Testing an OData service from ABAP otherwise means writing the HTTP plumbing by hand. This library wraps it behind a client, zcl_odata_test, that fetches a CSRF token, issues GET requests with URL variables substituted in from a key-value table, and chains assertions such as assert_http_200, assert_json_content_type and assert_json_path_exists onto the response. The maintainer names unit tests, ADT console runs and standalone programs as where to use it; both worked examples in the README are ADT console runs, one a single GET and one a loop over twenty business-partner keys. Every example calls the client's get method, and no assertion against a write is shown.

Facts

Last pushLicenceMIT

Where it sits

Lives in
Provides
Calling a service by handABAPCalling a service by handcapabilitySending a request to an OData service or a push channel on a system and reading what comes back, while building it or chasing an error, before any client exists. Distinct from [unit testing](capability:abap-unit-testing), which proves logic in code and keeps the proof.

Who is behind it

BlueFundaBlueFundaOrganisationMaintains this
In the atlas: maintains 1
@bluefunda
maintainerLars HvamPersonContributes to this
In the atlas: maintains 13, contributes to 92, wrote 1
@larshp
Phani PuttabakulaPersonContributes to this
In the atlas: contributes to 1
@phanikumarps
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

Connections1

README

quoted from bluefunda/abap-odata-test under MIT, read
bluefunda/abap-odata-test/README.mdOn GitHub

ABAP OData Test Library

Where to use

You can use this in writing unit-tests or in ADT for console run or in standalone programs.

Example:

ADT console run (Single GET)

TRY.
        DATA(url) = `/sap/opu/odata/IWFND/CATALOGSERVICE;v=2/ServiceCollection?$format=json`.
        DATA(odata_test_client) = zcl_odata_test=>new( ).
        out->write( odata_test_client->get_csrf_token( ) ).
        odata_test_client->get(
                                    url        = url
                                    csrf_fetch = abap_true
                                 )->assert_http_200(                                "HTTP 200 assertion
                                 )->assert_json_content_type(                       "'application/json; charset=utf-8'
                                 )->assert_csrf_token_not_initial(                  "'x-csrf-token' fetch
                                 )->assert_json_not_empty(                          "Empty JSON check
                                 )->assert_json_path_exists( '/d/results/1/Title'   "follows AJSON project
                              ).

        out->write( |INFO: | & |"GET | & |{ url }| & |"| & | passed | ).

        out->write( odata_test_client->get(
                            url        = url
                            csrf_fetch = abap_true
                          )->get_json_path_value( '/d/results/5/Title'
                         ) ).

      CATCH BEFORE UNWIND zcx_rest_client INTO DATA(exception).
        out->write( exception->get_text( )  ).
      CATCH cx_aunit_sbx_quit_test_method INTO DATA(uncaught_exception).
        out->write( |ERROR: | & |"GET | & |{ url }| & |"| & | failed| ).
    ENDTRY.

ADT Console Run (Multiple GETs)

METHOD if_oo_adt_classrun~main.

    TRY.

        DATA(bp_tab) = test_data( ). "prepare test data = 20 BP numbers

        LOOP AT bp_tab ASSIGNING FIELD-SYMBOL(<bp>).

          "prepare URL with variables
          "v1 = variable value - name can be any as long as it is enclosed with {}
          DATA(url) = `/sap/opu/odata/IWBEP/GWSAMPLE_BASIC/BusinessPartnerSet({v1})?$format=json`.

          "construct key-value table with variables and their respective values
          DATA vars TYPE zif_odata_test=>t_vars.
          vars = VALUE #( ( key = `v1` value = <bp> ) ).

          "call GET with URL & VARS
          DATA(odata_test_client) = zcl_odata_test=>new( ).
          DATA(result) =
                        odata_test_client->get(
                                                url  = url
                                                vars = vars  ).
          "check response body (one can check response time, response status, header etc)
          out->write( result->response->body ).

        ENDLOOP.

      CATCH zcx_odata_client INTO DATA(error).
        out->write( error->get_text( ) ).
    ENDTRY.

  ENDMETHOD.
MIT, read
Calling a service by hand
  1. ODAPUUI5 app for OData test requests and ABAP Push Channelsfrom ABAP

Details

Sources3
Added by handdiscovered herechecked
github.com/bluefunda/abap-odata-testtree, 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
discovered viaAdded by hand
first seen in the atlas
ecosystem and domainabap, developer-experience
abaplint
issues under its own abaplint configuration391
lines1,490
statements851
objects12
files22
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:bluefunda-abap-odata-test
JSON
/artifacts/bluefunda-abap-odata-test.json
MCP
Connecting an agent