on 2024 Jun 04 1:47 PM
i try to mock I_BillingDocument for tests,
but this works only for selects on I_BillingDocumentBasic and not at the root.
Can anyone tell me how to make select work based on I_BillingDocument? We are on HANA 2021.
go_cds = cl_cds_test_environment=>create( i_for_entity = 'I_BillingDocument' "
I_select_base_dependencies = abap_true ) .
go_cds->enable_double_redirection( ).
" mock data
DATA: vbrk_t TYPE STANDARD TABLE OF vbrk WITH EMPTY KEY.
vbrk_t = VALUE #( ( vbeln = '1234567890' ) ).
go_cds->insert_test_data( vbrk_t ).
" select - dosen't work
SELECT billingdocument
FROM I_BillingDocument
INTO TABLE @DATA(itest1) UP TO 10 ROWS.
" works
SELECT billingdocument
FROM I_BillingDocumentBasic
INTO TABLE @DATA(itest2) UP TO 10 ROWS.
The CDS Test Double Framework doubles the dependent on entities, not the entity itself. It's intended to test the CDS view itself, as you can see in the help: https://help.sap.com/docs/abap-cloud/abap-development-tools-user-guide/abap-cds-test-double-framewor...
If you want to double a certain CDS view directly, and not its dependencies, you can use the OSQL Test Double Framework. Something like:
DATA billing_docs TYPE STANDARD TABLE OF I_BillingDocument WITH EMPTY KEY.
billing_docs = VALUE #( ( BillingDocument = '1234567890' ) ).
DATA(osql_env) = cl_osql_test_environment=>create( VALUE #( ( 'I_BillingDocument' ) ) ).
osql_env->insert_test_data( billing_docs ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
70 | |
10 | |
8 | |
8 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.