CDS View Test Double framework-Unit test implementation approach
DevOps concept & making ABAP Test Cockpit ( ATC) more relevant for Development teams via automated unit tests!!!
Introduction & Needs
Above motivation lead us to implement CDS View unit test practices using Test Double Framework within S/4 HANA transformation program. The key challenge was to explore effective ways to implement this & within Net weaver 7.52 by which we could fulfill the below needs
– Need to check if Unit test exists or not for a CDS View created after a date which is different from the Baseline date of ATC
– Need to Execute the unit test before CDS Views are released to QA/Integration system
– Need to Execute only unit test relevant to the CDS views which are part of current transport release
– Need for possibility to exempt for certain CDS Views for which unit test might not be required
We could be gaining more efficiency in Unit Testing in SAP world if we address these above needs. Similar feature exists for ABAP unit and currently CDS View Unit test classes are yet to be supported , these requirement’s made us to explore a more pragmatic approach.
I elaborate the approach in detail below with pre-requisites & custom check’s logic
– Enable ATC check to be executed during Transport release – Transport tool Integration
– Store all the Unit tests in a single development package
High level overview of the Process
Our approach with this New Custom Check ( For knowing how to create custom check please refer Blog post on how to create new custom check) & Integrated with ATC via Check variant is to
– Identify the CDS View which is being released as part of ATC check run during TR or Task release
– Qualify the CDS View if it should have CDS View unit or not based on the its creation date ( Creation date >= Configured date)
– Identify the related CDS View unit test class stored in a single development package specific to the CDS View under test (CUT) which is being released
– Execute the unit test for this CDS View as part of ATC check & return results of unit test
Finally, Transport / Task released with Unit Tested & CDS View unit test results determine if the TR / Task release could happen or not!!!We are live with this solution and thanks to my team who could make this happen.
As a conclusion , we believe have found pragmatic way to achieve this without any additional tooling required.
Idea of sharing our approach is to get to know feedback /suggestions from the wide SAP Developers & Practitioner community.