‎2016 Feb 17 4:39 PM
Dear BOPF Colleagues,
I would ask do you have any correct, working implementation, or PoC how to write correct unit test for BOPF CRUD operations without calling the determination event?
These CRUD operations are NOT actions under Business objects, we fill up the modification table with the corresponding BO operation code and then
call service manager modify and transaction manager save.
We have an normal ABAP class called Planning Profile API, which creates, updates, copies and deletes Planning Profile Object data via BOPF framework.
I tried to write ABAP unit test but either the determination is called on delete and the transaction manager doesnot save the deletion
or if I tried to mock service and transactionm manager it went into infinite loop in retieve of service manager.
Do you have any working iimplementation how to unit test a create-update-delete operation? Please help.
Thank you & regards,
Csaba
‎2016 Feb 18 4:24 AM
Hello Csaba,
as BOPF automatically takes care of create, update and delete, what is the intention to have a test exactly for this (without any determination)? Do you have an own DAC/buffer?
Usually a BOPF "unit" (=smallest unit to be tested) test is focusing a single implementation class like an action, determination, or validation class. Thereto we have a BOPF unit test framework available.
Testing a whole core service is usally part of a scenario test and therefor the service manager can be used and the DAC layer can be mocked.
Best regards
Tilmann
‎2016 Feb 18 9:43 AM
Hello Tilmann,
This unit test is more like a scenario test as this would test the whole process from create to delete.
I planned to create a scenario test which would have several test steps for CRUD operations. I would use real Data Access Layer (not mocked DAC).
The test steps are:
1. Create an Business object with predefined data
2. Update this Business object (change some sttribute value)
3. Copy Business Object creating new one
4. Delete recently created Business Object
All these steps would use the real BOPF service and transaction managers and would write data into the database (into ABAP transparent tables).
We should skip the running of determination class/event somehow, because it blocks the step 4: deletion of created test BOPF data.
Is it possible to run unit test which writes into database?
Thank you for your help.
Best regards,
Csaba
‎2016 Feb 23 10:12 AM
Based our discussion we will use an private attribute flag added to the determination class which will control of using determination (either called from real API or from unit test).
The Unit test class will be friend of this determination class so it can set this parameter.
Tilmann, thank you for your help!