01-14-2009 3:12 PM
Hi,
I want to do a unit test for Fm ,but the FM input have some value that always changing and other
Are stay the same ,and the FM output change accordingly , i can build a unit test for this kind of FM,
Or it's worthless ?
Regards
Ricardo Arona
01-14-2009 3:37 PM
It all depends on the purpose of your Function module.
If you are only selecting some records from the database into output based on your inputs, than it is not advisable to write ABAP unit test on that FM.
But your FM invovles some kind of processing i.e. collecting table, modifying data in to internal table, filling up final table etc than you should write ABAP Unit only on that Subroutine.
Check this recent discussion:
Regards,
Naimesh Patel
01-14-2009 3:33 PM
Hi,
just a suggestion.
Create a variant for the testing of the function module (the save icon after input the FM parameters).
Call always that test variant and change the only values that you have to change.
Bye
Andrea
01-14-2009 3:37 PM
It all depends on the purpose of your Function module.
If you are only selecting some records from the database into output based on your inputs, than it is not advisable to write ABAP unit test on that FM.
But your FM invovles some kind of processing i.e. collecting table, modifying data in to internal table, filling up final table etc than you should write ABAP Unit only on that Subroutine.
Check this recent discussion:
Regards,
Naimesh Patel
01-14-2009 4:00 PM
Hi Naimesh,
But your FM involves some kind of processing i.e. collecting table, modifying data in to internal table, filling up final table etc than you should write ABAP Unit only on that Subroutine.
Yea , my FM get always different key.
the WORKITEM_ID is unique and always changing.
like :
Import
WORKITEM_ID - 005104574
DECISION_KEY - 0001
USER_ID - C0267195
OPERATION_ID - EXEC
so the export data is always changing accordingly .
What u suggest for this kind of issue?
Regards
01-14-2009 4:08 PM
Do you select DECISION_KEY, USER_ID, OPERATION_ID from the Database based on the WORKITEM_ID? If yes, than you should NOT write a Unit Test because data in the database can be changed and it leads to failure of your ABAP test in Future.
E.g.
Today, For
WORKITEM_ID - 005104574
You get:
DECISION_KEY - 0001
USER_ID - C0267195
OPERATION_ID - EXEC
But Someone changed OPERATION_ID from EXEC to PLAN.
So, after the changed OPERATION_ID your test will fail because you have hardcoded the OPERATION_ID as EXEC in your ABAP Unit. This test would fail because the data got changed, not the logic. So, it doesn't serve the purpose of writing the unit test.
Regards,
Naimesh Patel