Skip to Content
-1

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

Nov 30, 2017 at 04:33 PM

36

avatar image
Former Member

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.

10 |10000 characters needed characters left characters exceeded

Just a comment: The INTO clause should be the last clause of a SELECT statement.

0
* Please Login or Register to Answer, Follow or Comment.

0 Answers