Skip to Content
avatar image
-1
Former Member

How to check if my data is actually getting stubbed in test double framework classes for CDS views?

LT_DATA = VALUE #( ( Material = 'abc' ) ).

TEST_DATA = CL_CDS_TEST_DATA=>CREATE( i_data = LT_DATA ).

DATA(STUB_1) = ENVIRONMENT->GET_DOUBLE( 'CDSVIEW' ).

STUB_1->INSERT( TEST_DATA ).

SELECT * FROM CDS_VIEW_NAME INTO TABLE @ACT_RESULTS.

EXP_RESULTS = VALUE #( ( Material = 'abc' ) ).

CL_ABAP_UNIT_ASSERT=>ASSERT_EQUALS( ACT = LINES( ACT_RESULTS ) EXP = LINES( EXP_RESULTS ) ).

Above is the syntax, I used for testing my CDS view using test double framework.

Now, to check if my data is actually getting stubbed or is it directly picking up data from the tables, I wrote the following syntax.

Select * into @DATA(stub_2) from CDS_VIEW_NAME.

If this is incorrect, please guide me with the correct way of checking if my data is getting stubbed or directly getting picked from table and then comparing with exp_results.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers