‎2017 Jun 13 4:06 AM
Hi experts,
Say I want a DB handler class as below, in which method is pure Open SQL statement.
CLASS lcl_mara_db_handler IMPLEMETATION.
METHOD update_mara.
MODIFY mara FROM is_mara.
ENDMETHOD.
METHOD insert_mara.
INSERT.........
ENDMETHOD.
.......
ENDCLASS.
How can I write Unit Test first, as the decency is DB, do I need to consider that a different DB could return a different result? Or not necessary to consider the Unit Test on this leave?
BRs,
Archer
‎2017 Jun 13 5:13 AM
For that, we have test seams and injections.
https://blogs.sap.com/2015/10/23/abap-news-for-750-test-seams-and-injections
Since you are with SAP, you might also check the 7.52 documentation for another new possibility.
‎2017 Jun 13 5:13 AM
For that, we have test seams and injections.
https://blogs.sap.com/2015/10/23/abap-news-for-750-test-seams-and-injections
Since you are with SAP, you might also check the 7.52 documentation for another new possibility.
‎2017 Jun 13 6:56 AM
hmm can you tell more about that ("another new possibility"), Horst? 😄
‎2017 Jun 13 7:09 AM
Nope. I'm not allowed to do so before 7.52 is available outside SAP.
But why not some teasing 😉
‎2017 Jun 13 7:22 AM
‎2017 Jun 13 7:43 AM
Don't Let Me Be Misunderstood ...
The teasing already happened by mentioning 7.52 at all ...
‎2017 Jun 13 6:27 PM
Hi Sandra,
how to enable (integration) testing with OpenSQL? I would presume the ABAP Unit framework will be enhanced to
What do you think? Horst can vote me down to stop fake news 🙂
JNN
‎2017 Jun 13 7:20 PM
I thought the test seam / injection thing was only a workaround to make legacy code testable without rewriting it.
In the example above I would have abstracted the functionality to an interface and implemented it twice, having a productive implementation that uses opensql and a (possibly local) test implementation with dummy data / return values (maybe even using cl_abap_testdouble). Is that not the recommended approach?
‎2017 Jun 13 7:22 PM
I would never have guessed that SAP would be working on another version 😉
‎2017 Jun 13 7:25 PM
One can "like" a comment, but one can only downvote an answer. One of the many peculiarities of the new SCN platform.
I like your thinking though, perhaps something like DB table overloading?
‎2017 Jun 13 7:46 PM
‎2017 Jun 13 7:54 PM
‎2018 Feb 09 1:49 PM
Well horst.keller it is official now:
ABAP - Keyword Documentation → ABAP - Reference → Processing External Data → ABAP Database Accesses → Open SQL →Open SQL - System Classes → CL_OSQL_REPLACE - Replacement Service
I have found the class in Netweaver 7.51. Is it the same functionality?
JNN
‎2018 Feb 09 5:44 PM
Point 11 under https://help.sap.com/http.svc/rc/abapdocu_752_index_htm/7.52/en-US/index.htm?file=abennews-752-open_...
So, officially available with 7.52.
‎2017 Jun 13 6:41 AM
OpenSQL gives the same result whatever the database is, that's the reason of being of OpenSQL (in answer to "do I need to consider that a different DB could return a different result?") I probably didn't get your point, sorry.
‎2019 Dec 17 2:49 AM
maybe you can 'select' again after 'ins/del/upd' of D, and then compare the ACT and EXP in your test method. to verify if the update openSQL actually works.