├── src ├── zati_cds_entity.ddls.baseinfo ├── package.devc.xml ├── zati_if_depended_on_component.intf.abap ├── zati_cds_entity.ddls.xml ├── zati_cds_entity.ddls.asddls ├── zati_cl_factory.clas.xml ├── zati_if_code_under_test.intf.xml ├── zati_if_depended_on_component.intf.xml ├── zati_th_injector.clas.xml ├── zati_cl_depended_on_component.clas.xml ├── zati_cl_depended_on_component.clas.abap ├── zati_cl_code_under_test.clas.xml ├── zati_th_injector.clas.abap ├── zati_if_code_under_test.intf.abap ├── zati_cl_factory.clas.abap ├── zati_cl_code_under_test.clas.abap └── zati_cl_code_under_test.clas.testclasses.abap ├── .abapgit.xml ├── REUSE.toml ├── README.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE └── LICENSES └── Apache-2.0.txt /src/zati_cds_entity.ddls.baseinfo: -------------------------------------------------------------------------------- 1 | { 2 | "BASEINFO": 3 | { 4 | "FROM": 5 | [ 6 | "DEMO_SALES_SO_I" 7 | ], 8 | "ASSOCIATED": 9 | [], 10 | "BASE": 11 | [], 12 | "ANNO_REF": 13 | [], 14 | "SCALAR_FUNCTION": 15 | [], 16 | "VERSION":0, 17 | "ANNOREF_EVALUATION_ERROR":"" 18 | } 19 | } -------------------------------------------------------------------------------- /.abapgit.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | E 6 | /src/ 7 | PREFIX 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/package.devc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Test Isolation Demo 7 | H 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/zati_if_depended_on_component.intf.abap: -------------------------------------------------------------------------------- 1 | interface zati_if_depended_on_component public. 2 | 3 | methods add importing i_summand_1 type i 4 | i_summand_2 type i 5 | returning value(r_sum) type i. 6 | 7 | methods subtract importing i_minuend type i 8 | i_subtrahend type i 9 | returning value(r_difference) type i. 10 | 11 | endinterface. 12 | -------------------------------------------------------------------------------- /src/zati_cds_entity.ddls.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ZATI_CDS_ENTITY 7 | E 8 | CDS Entity 9 | W 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/zati_cds_entity.ddls.asddls: -------------------------------------------------------------------------------- 1 | @AbapCatalog.viewEnhancementCategory: [#NONE] 2 | @AccessControl.authorizationCheck: #NOT_REQUIRED 3 | @EndUserText.label: 'CDS Entity' 4 | @Metadata.ignorePropagatedAnnotations: true 5 | @ObjectModel.usageType:{ 6 | serviceQuality: #X, 7 | sizeCategory: #S, 8 | dataClass: #MIXED 9 | } 10 | define view entity ZATI_CDS_ENTITY 11 | as select from demo_sales_so_i 12 | { 13 | key parent_key as SalesOrder, 14 | count(distinct so_item_key) as ItemCount 15 | } 16 | group by 17 | parent_key 18 | -------------------------------------------------------------------------------- /src/zati_cl_factory.clas.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ZATI_CL_FACTORY 7 | E 8 | Factory 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/zati_if_code_under_test.intf.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ZATI_IF_CODE_UNDER_TEST 7 | E 8 | Code Under Test 9 | 2 10 | 1 11 | X 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/zati_if_depended_on_component.intf.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ZATI_IF_DEPENDED_ON_COMPONENT 7 | E 8 | Depended-On Component 9 | 2 10 | 1 11 | X 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/zati_th_injector.clas.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ZATI_TH_INJECTOR 7 | E 8 | Injector 9 | 05 10 | 1 11 | X 12 | X 13 | X 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/zati_cl_depended_on_component.clas.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ZATI_CL_DEPENDED_ON_COMPONENT 7 | E 8 | Depended-On Component 9 | 1 10 | X 11 | X 12 | X 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/zati_cl_depended_on_component.clas.abap: -------------------------------------------------------------------------------- 1 | class zati_cl_depended_on_component definition 2 | public 3 | create private 4 | global friends zati_cl_factory. 5 | 6 | public section. 7 | interfaces zati_if_depended_on_component. 8 | 9 | protected section. 10 | 11 | private section. 12 | 13 | endclass. 14 | 15 | 16 | class zati_cl_depended_on_component implementation. 17 | method zati_if_depended_on_component~add. 18 | assert 1 = 0. 19 | endmethod. 20 | 21 | method zati_if_depended_on_component~subtract. 22 | r_difference = i_minuend - i_subtrahend. 23 | endmethod. 24 | endclass. 25 | -------------------------------------------------------------------------------- /src/zati_cl_code_under_test.clas.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ZATI_CL_CODE_UNDER_TEST 7 | E 8 | Code Under Test 9 | 1 10 | X 11 | X 12 | X 13 | X 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/zati_th_injector.clas.abap: -------------------------------------------------------------------------------- 1 | class zati_th_injector definition 2 | public 3 | final 4 | for testing 5 | create private. 6 | 7 | public section. 8 | class-methods 9 | inject_code_under_test 10 | importing i_double type ref to zati_if_code_under_test. 11 | 12 | class-methods 13 | inject_depended_on_component 14 | importing i_double type ref to zati_if_depended_on_component. 15 | 16 | class-methods 17 | clear. 18 | endclass. 19 | 20 | 21 | class zati_th_injector implementation. 22 | method clear. 23 | clear zati_cl_factory=>g_code_under_test. 24 | clear zati_cl_factory=>g_depended_on_component. 25 | endmethod. 26 | 27 | method inject_code_under_test. 28 | zati_cl_factory=>g_code_under_test = i_double. 29 | endmethod. 30 | 31 | method inject_depended_on_component. 32 | zati_cl_factory=>g_depended_on_component = i_double. 33 | endmethod. 34 | endclass. 35 | -------------------------------------------------------------------------------- /src/zati_if_code_under_test.intf.abap: -------------------------------------------------------------------------------- 1 | interface zati_if_code_under_test public. 2 | 3 | types t_items_per_sales_order type hashed table of zati_cds_entity with unique key salesorder. 4 | types t_failed type response for failed /dmo/i_travel_m. 5 | types t_reported type response for reported /dmo/i_travel_m. 6 | types t_mapped type response for mapped /dmo/i_travel_m. 7 | 8 | methods call_other_object returning value(r_result) type i. 9 | 10 | methods select_database_table returning value(r_result) type t_items_per_sales_order. 11 | 12 | methods select_cds_entity returning value(r_result) type t_items_per_sales_order. 13 | 14 | methods call_function_module returning value(r_result) type char1. 15 | 16 | methods call_authority_check returning value(r_result) type i. 17 | 18 | methods call_rap_business_object exporting e_reported type t_reported 19 | e_failed type t_failed 20 | e_mapped type t_mapped. 21 | 22 | endinterface. 23 | -------------------------------------------------------------------------------- /src/zati_cl_factory.clas.abap: -------------------------------------------------------------------------------- 1 | class zati_cl_factory definition 2 | public 3 | final 4 | create private 5 | global friends zati_th_injector. 6 | 7 | public section. 8 | class-methods 9 | get_code_under_test 10 | returning value(r_instance) type ref to zati_if_code_under_test. 11 | 12 | class-methods 13 | get_depended_on_component 14 | returning value(r_instance) type ref to zati_if_depended_on_component. 15 | 16 | private section. 17 | class-data g_code_under_test type ref to zati_if_code_under_test. 18 | class-data g_depended_on_component type ref to zati_if_depended_on_component. 19 | endclass. 20 | 21 | 22 | class zati_cl_factory implementation. 23 | method get_code_under_test. 24 | r_instance = cond #( when g_code_under_test is not bound then new zati_cl_code_under_test( ) else g_code_under_test ). 25 | endmethod. 26 | 27 | method get_depended_on_component. 28 | r_instance = cond #( when g_depended_on_component is not bound 29 | then new zati_cl_depended_on_component( ) 30 | else g_depended_on_component ). 31 | endmethod. 32 | endclass. 33 | -------------------------------------------------------------------------------- /REUSE.toml: -------------------------------------------------------------------------------- 1 | version = 1 2 | SPDX-PackageName = "abap-test-isolation-examples" 3 | SPDX-PackageSupplier = "ospo@sap.com" 4 | SPDX-PackageDownloadLocation = "https://github.com/sap-samples/abap-test-isolation-examples" 5 | SPDX-PackageComment = "The code in this project may include calls to APIs (\"API Calls\") of\n SAP or third-party products or services developed outside of this project\n (\"External Products\").\n \"APIs\" means application programming interfaces, as well as their respective\n specifications and implementing code that allows software to communicate with\n other software.\n API Calls to External Products are not licensed under the open source license\n that governs this project. The use of such API Calls and related External\n Products are subject to applicable additional agreements with the relevant\n provider of the External Products. In no event shall the open source license\n that governs this project grant any rights in or to any External Products,or\n alter, expand or supersede any terms of the applicable additional agreements.\n If you have a valid license agreement with SAP for the use of a particular SAP\n External Product, then you may make use of any API Calls included in this\n project's code for that SAP External Product, subject to the terms of such\n license agreement. If you do not have a valid license agreement for the use of\n a particular SAP External Product, then you may only make use of any API Calls\n in this project for that SAP External Product for your internal, non-productive\n and non-commercial test and evaluation of such API Calls. Nothing herein grants\n you any rights to use or access any SAP External Product, or provide any third\n parties the right to use of access any SAP External Product, through API Calls." 6 | 7 | [[annotations]] 8 | path = "**" 9 | precedence = "aggregate" 10 | SPDX-FileCopyrightText = "2023 SAP SE or an SAP affiliate company and abap-test-isolation-examples contributors" 11 | SPDX-License-Identifier = "Apache-2.0" 12 | -------------------------------------------------------------------------------- /src/zati_cl_code_under_test.clas.abap: -------------------------------------------------------------------------------- 1 | class zati_cl_code_under_test definition 2 | public 3 | create private 4 | global friends zati_cl_factory. 5 | 6 | public section. 7 | interfaces zati_if_code_under_test. 8 | 9 | protected section. 10 | 11 | private section. 12 | endclass. 13 | 14 | 15 | class zati_cl_code_under_test implementation. 16 | method zati_if_code_under_test~call_other_object. 17 | final(doc) = zati_cl_factory=>get_depended_on_component( ). 18 | r_result = doc->add( i_summand_1 = 1 19 | i_summand_2 = 2 ). 20 | endmethod. 21 | 22 | method zati_if_code_under_test~call_function_module. 23 | call function 'POPUP_TO_CONFIRM' 24 | exporting text_question = 'Do you want this?' 25 | importing answer = r_result. 26 | endmethod. 27 | 28 | method zati_if_code_under_test~select_database_table. 29 | select from demo_sales_so_i 30 | fields parent_key as salesorder, count( so_item_key ) as itemcount 31 | group by parent_key 32 | into table @r_result. 33 | endmethod. 34 | 35 | method zati_if_code_under_test~select_cds_entity. 36 | select from zati_cds_entity 37 | fields salesorder, itemcount 38 | into table @r_result. 39 | endmethod. 40 | 41 | method zati_if_code_under_test~call_authority_check. 42 | authority-check object 'S_DEVELOP' 43 | id 'ACTVT' field '02'. 44 | r_result = sy-subrc. 45 | endmethod. 46 | 47 | method zati_if_code_under_test~call_rap_business_object. 48 | modify entities of /dmo/i_travel_m 49 | entity travel 50 | create from value #( ( %cid = 'Travel_1' 51 | agency_id = '000111' 52 | customer_id = '000006' 53 | description = 'Travel 1' 54 | %control-agency_id = if_abap_behv=>mk-on 55 | %control-customer_id = if_abap_behv=>mk-on 56 | %control-description = if_abap_behv=>mk-on ) ) 57 | reported e_reported 58 | failed e_failed 59 | mapped e_mapped. 60 | endmethod. 61 | endclass. 62 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ABAP Test Isolation Examples 2 | [![REUSE status](https://api.reuse.software/badge/github.com/SAP-samples/abap-test-isolation-examples)](https://api.reuse.software/info/github.com/SAP-samples/abap-test-isolation-examples) 3 | 4 | This repository contains examples for all currently available test isolation tools in the ABAP Platform. 5 | 6 | ## The Idea 7 | The idea of this repository is to show how to use any test environment, helper class and some common design patterns that help with isolating your code under test from its depended-on components. 8 | 9 | ## How To Use This Repository 10 | If you want to isolate your code under test from the components it uses, you need to take a look at what your depended-on component is. Each isolation technique for a specific kind of depended-on component is used separate test class of the global class ZATI_CL_CODE_UNDER_TEST. 11 | The table below shows which test class uses which tool to isolate against which kind of depended-on component. 12 | 13 | Test Class | Depended-On Component | Tool | First Release 14 | ----- | ----- | ------ | ------ 15 | ltc_call_other_object | Classes | Self-made test doubles | With ABAP OO 16 | ltc_call_other_object_fw | Classes | [ABAP Object Oriented Test Double Framework](https://help.sap.com/docs/ABAP_PLATFORM/c238d694b825421f940829321ffa326a/804c251e9c19426cadd1395978d3f17b.html?locale=en-US) | SAP BASIS 740 SP9 17 | ltc_call_function_module | Function Modules | [Function Module Test Double Framework](https://help.sap.com/docs/SAP_S4HANA_CLOUD/25cf71e63940453397a32dc2b7676947/75964f284aa9435da40c4d82e111f276.html?locale=en-US) | SAP NetWeaver 756 18 | ltc_select_database_table | Database Tables and CDS Entities | [ABAP SQL Test Double Framework](https://help.sap.com/docs/ABAP_PLATFORM/c238d694b825421f940829321ffa326a/1432ca1fc7b547d493f691cdd09245ae.html?locale=en-US) | SAP NetWeaver 752 19 | ltc_select_cds_entity | Database Artefacts which are used in CDS | [ABAP CDS Test Double Framework](https://help.sap.com/docs/ABAP_PLATFORM_NEW/c238d694b825421f940829321ffa326a/cbedc08ff4de48ffa8d04d3067ef08e7.html?locale=en-US) | SAP NetWeaver 751 20 | ltc_call_authority_check | Authority Checks | [Classic ABAP Authority Check Test Helper API](https://help.sap.com/docs/ABAP_PLATFORM_NEW/c238d694b825421f940829321ffa326a/6500d4d8f89a4743a6c0513d659a475b.html?locale=en-US) | SAP NetWeaver 755 21 | ltcl_call_rap_bo_tx_bf_dbl | RAP Business Objects | [Transactional Buffer Double Support](https://help.sap.com/docs/SAP_S4HANA_CLOUD/25cf71e63940453397a32dc2b7676947/0337944d45994a3ba7482421cdfe36c8.html) | SAP NetWeaver 757 22 | ltcl_call_rap_bo_mock_eml_api | RAP Business Objects | [Mock EML API Support](https://help.sap.com/docs/SAP_S4HANA_CLOUD/25cf71e63940453397a32dc2b7676947/4fa0e8a6ea0d4c45bec1afdc1ac6bd49.html?locale=en-US) | SAP NetWeaver 757 23 | 24 | ## Requirements 25 | You need a system with an ABAP runtime and [abapGit](https://github.com/abapGit/abapGit). 26 | 27 | ## Download and Installation 28 | You can pull the code with [abapGit](https://github.com/abapGit/abapGit) to any system with an ABAP runtime. 29 | 30 | ## How to obtain support 31 | [Create an issue](https://github.com/SAP-samples/abap-test-isolation-examples/issues) in this repository if you find a bug or have questions about the content. 32 | 33 | For additional support, [ask a question in SAP Community](https://answers.sap.com/questions/ask.html). 34 | 35 | ## Code of Conduct 36 | If you want to contribute to this repository, please check our [Code of Conduct](https://github.com/SAP-samples/abap-test-isolation-examples/blob/main/CODE_OF_CONDUCT.md). 37 | 38 | ## Contributing 39 | Please feel free to check our [Contribution-Guide](https://github.com/SAP-samples/abap-test-isolation-examples/blob/main/CONTRIBUTING.md). 40 | 41 | ## License 42 | Copyright (c) 2023 SAP SE or an SAP affiliate company. All rights reserved. This project is licensed under the Apache Software License, version 2.0 except as noted otherwise in the [LICENSE](LICENSE) file. 43 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | 2 | # Contributor Covenant Code of Conduct 3 | 4 | ## Our Pledge 5 | 6 | We as members, contributors, and leaders pledge to make participation in our 7 | community a harassment-free experience for everyone, regardless of age, body 8 | size, visible or invisible disability, ethnicity, sex characteristics, gender 9 | identity and expression, level of experience, education, socio-economic status, 10 | nationality, personal appearance, race, caste, color, religion, or sexual 11 | identity and orientation. 12 | 13 | We pledge to act and interact in ways that contribute to an open, welcoming, 14 | diverse, inclusive, and healthy community. 15 | 16 | ## Our Standards 17 | 18 | Examples of behavior that contributes to a positive environment for our 19 | community include: 20 | 21 | * Demonstrating empathy and kindness toward other people 22 | * Being respectful of differing opinions, viewpoints, and experiences 23 | * Giving and gracefully accepting constructive feedback 24 | * Accepting responsibility and apologizing to those affected by our mistakes, 25 | and learning from the experience 26 | * Focusing on what is best not just for us as individuals, but for the overall 27 | community 28 | 29 | Examples of unacceptable behavior include: 30 | 31 | * The use of sexualized language or imagery, and sexual attention or advances of 32 | any kind 33 | * Trolling, insulting or derogatory comments, and personal or political attacks 34 | * Public or private harassment 35 | * Publishing others' private information, such as a physical or email address, 36 | without their explicit permission 37 | * Other conduct which could reasonably be considered inappropriate in a 38 | professional setting 39 | 40 | ## Enforcement Responsibilities 41 | 42 | Community leaders are responsible for clarifying and enforcing our standards of 43 | acceptable behavior and will take appropriate and fair corrective action in 44 | response to any behavior that they deem inappropriate, threatening, offensive, 45 | or harmful. 46 | 47 | Community leaders have the right and responsibility to remove, edit, or reject 48 | comments, commits, code, wiki edits, issues, and other contributions that are 49 | not aligned to this Code of Conduct, and will communicate reasons for moderation 50 | decisions when appropriate. 51 | 52 | ## Scope 53 | 54 | This Code of Conduct applies within all community spaces, and also applies when 55 | an individual is officially representing the community in public spaces. 56 | Examples of representing our community include using an official e-mail address, 57 | posting via an official social media account, or acting as an appointed 58 | representative at an online or offline event. 59 | 60 | ## Enforcement Guidelines 61 | 62 | Community leaders will follow these Community Impact Guidelines in determining 63 | the consequences for any action they deem in violation of this Code of Conduct: 64 | 65 | ### 1. Correction 66 | 67 | **Community Impact**: Use of inappropriate language or other behavior deemed 68 | unprofessional or unwelcome in the community. 69 | 70 | **Consequence**: A private, written warning from community leaders, providing 71 | clarity around the nature of the violation and an explanation of why the 72 | behavior was inappropriate. A public apology may be requested. 73 | 74 | ### 2. Warning 75 | 76 | **Community Impact**: A violation through a single incident or series of 77 | actions. 78 | 79 | **Consequence**: A warning with consequences for continued behavior. No 80 | interaction with the people involved, including unsolicited interaction with 81 | those enforcing the Code of Conduct, for a specified period of time. This 82 | includes avoiding interactions in community spaces as well as external channels 83 | like social media. Violating these terms may lead to a temporary or permanent 84 | ban. 85 | 86 | ### 3. Temporary Ban 87 | 88 | **Community Impact**: A serious violation of community standards, including 89 | sustained inappropriate behavior. 90 | 91 | **Consequence**: A temporary ban from any sort of interaction or public 92 | communication with the community for a specified period of time. No public or 93 | private interaction with the people involved, including unsolicited interaction 94 | with those enforcing the Code of Conduct, is allowed during this period. 95 | Violating these terms may lead to a permanent ban. 96 | 97 | ### 4. Permanent Ban 98 | 99 | **Community Impact**: Demonstrating a pattern of violation of community 100 | standards, including sustained inappropriate behavior, harassment of an 101 | individual, or aggression toward or disparagement of classes of individuals. 102 | 103 | **Consequence**: A permanent ban from any sort of public interaction within the 104 | community. 105 | 106 | ## Attribution 107 | 108 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 109 | version 2.1, available at 110 | [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. 111 | 112 | Community Impact Guidelines were inspired by 113 | [Mozilla's code of conduct enforcement ladder][Mozilla CoC]. 114 | 115 | For answers to common questions about this code of conduct, see the FAQ at 116 | [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at 117 | [https://www.contributor-covenant.org/translations][translations]. 118 | 119 | [homepage]: https://www.contributor-covenant.org 120 | [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html 121 | [Mozilla CoC]: https://github.com/mozilla/diversity 122 | [FAQ]: https://www.contributor-covenant.org/faq 123 | [translations]: https://www.contributor-covenant.org/translations 124 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | 2 | # Contributing to ABAP Test Isolation Examples 3 | 4 | First off, thanks for taking the time to contribute! ❤️ 5 | 6 | All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. The community looks forward to your contributions. 🎉 7 | 8 | > And if you like the project, but just don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about: 9 | > - Star the project 10 | > - Tweet about it 11 | > - Refer this project in your project's readme 12 | > - Mention the project at local meetups and tell your friends/colleagues 13 | 14 | 15 | ## Table of Contents 16 | 17 | - [Code of Conduct](#code-of-conduct) 18 | - [I Have a Question](#i-have-a-question) 19 | - [I Want To Contribute](#i-want-to-contribute) 20 | - [Reporting Bugs](#reporting-bugs) 21 | - [Suggesting Enhancements](#suggesting-enhancements) 22 | 23 | 24 | 25 | ## Code of Conduct 26 | 27 | This project and everyone participating in it is governed by the 28 | [ABAP Test Isolation Examples Code of Conduct](https://github.com/SAP-samples/abap-test-isolation-examplesblob/main/CODE_OF_CONDUCT.md). 29 | By participating, you are expected to uphold this code. Please report unacceptable behavior 30 | to <>. 31 | 32 | 33 | ## I Have a Question 34 | 35 | Before you ask a question, it is best to search for existing [Issues](https://github.com/SAP-samples/abap-test-isolation-examples/issues) that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first. 36 | 37 | If you then still feel the need to ask a question and need clarification, we recommend the following: 38 | 39 | - Open an [Issue](https://github.com/SAP-samples/abap-test-isolation-examples/issues/new). 40 | - Provide as much context as you can about what you're running into. 41 | - Provide project and platform versions, depending on what seems relevant. 42 | 43 | We will then take care of the issue as soon as possible. 44 | 45 | 59 | 60 | ## I Want To Contribute 61 | 62 | > ### Legal Notice 63 | > When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the project license. 64 | 65 | ### Reporting Bugs 66 | 67 | 68 | #### Before Submitting a Bug Report 69 | 70 | A good bug report shouldn't leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible. 71 | 72 | - Make sure that you are using the latest version. 73 | - Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions (Make sure that you have read the README. 74 | - To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the [bug tracker](https://github.com/SAP-samples/abap-test-isolation-examples/issues?q=label%3Abug). 75 | - Also make sure to search the internet (including Stack Overflow) to see if users outside of the GitHub community have discussed the issue. 76 | - Collect information about the bug: 77 | - Stack trace (Traceback) 78 | - OS, Platform and Version (Windows, Linux, macOS, x86, ARM) 79 | - Version of the interpreter, compiler, SDK, runtime environment, package manager, depending on what seems relevant. 80 | - Possibly your input and the output 81 | - Can you reliably reproduce the issue? And can you also reproduce it with older versions? 82 | 83 | 84 | #### How Do I Submit a Good Bug Report? 85 | 86 | > You must never report security related issues, vulnerabilities or bugs including sensitive information to the issue tracker, or elsewhere in public. Instead sensitive bugs must be sent by email to <>. 87 | 88 | 89 | We use GitHub issues to track bugs and errors. If you run into an issue with the project: 90 | 91 | - Open an [Issue](https://github.com/SAP-samples/abap-test-isolation-examples/issues/new). (Since we can't be sure at this point whether it is a bug or not, we ask you not to talk about a bug yet and not to label the issue.) 92 | - Explain the behavior you would expect and the actual behavior. 93 | - Please provide as much context as possible and describe the *reproduction steps* that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case. 94 | - Provide the information you collected in the previous section. 95 | 96 | Once it's filed: 97 | 98 | - The project team will label the issue accordingly. 99 | - A team member will try to reproduce the issue with your provided steps. If there are no reproduction steps or no obvious way to reproduce the issue, the team will ask you for those steps and mark the issue as `needs-repro`. Bugs with the `needs-repro` tag will not be addressed until they are reproduced. 100 | - If the team is able to reproduce the issue, it will be marked `needs-fix`, as well as possibly other tags (such as `critical`), and the issue will be left to be implemented by someone. 101 | 102 | 103 | 104 | 105 | ### Suggesting Enhancements 106 | 107 | This section guides you through submitting an enhancement suggestion for ABAP Test Isolation Examples, **including completely new features and minor improvements to existing functionality**. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions. 108 | 109 | 110 | #### Before Submitting an Enhancement 111 | 112 | - Make sure that you are using the latest version. 113 | - Perform a [search](https://github.com/SAP-samples/abap-test-isolation-examples/issues) to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one. 114 | - Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset. If you're just targeting a minority of users, consider writing an add-on/plugin library. 115 | 116 | 117 | #### How Do I Submit a Good Enhancement Suggestion? 118 | 119 | Enhancement suggestions are tracked as [GitHub issues](https://github.com/SAP-samples/abap-test-isolation-examples/issues). 120 | 121 | - Use a **clear and descriptive title** for the issue to identify the suggestion. 122 | - Provide a **step-by-step description of the suggested enhancement** in as many details as possible. 123 | - **Describe the current behavior** and **explain which behavior you expected to see instead** and why. At this point you can also tell which alternatives do not work for you. 124 | - You may want to **include screenshots and animated GIFs** which help you demonstrate the steps or point out the part which the suggestion is related to. You can use [this tool](https://www.cockos.com/licecap/) to record GIFs on macOS and Windows, and [this tool](https://github.com/colinkeenan/silentcast) or [this tool](https://github.com/GNOME/byzanz) on Linux. 125 | - **Explain why this enhancement would be useful** to most ABAP Test Isolation Examples users. You may also want to point out the other projects that solved it better and which could serve as inspiration. 126 | 127 | 128 | 129 | 130 | ## Attribution 131 | This guide is based on the **contributing-gen**. [Make your own](https://github.com/bttger/contributing-gen)! 132 | 133 | ## Developer Certificate of Origin 134 | Due to legal reasons, contributors will be asked to accept a DCO when they create the first pull request to this project. This happens in an automated fashion during the submission process. SAP uses [the standard DCO text of the Linux Foundation](https://developercertificate.org/). -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2025 SAP SE 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /LICENSES/Apache-2.0.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /src/zati_cl_code_under_test.clas.testclasses.abap: -------------------------------------------------------------------------------- 1 | class ltd_depended_on_component definition for testing. 2 | 3 | public section. 4 | interfaces zati_if_depended_on_component partially implemented. 5 | 6 | data m_result type i. 7 | 8 | endclass. 9 | 10 | 11 | class ltd_depended_on_component implementation. 12 | method zati_if_depended_on_component~add. 13 | r_sum = m_result. 14 | endmethod. 15 | endclass. 16 | 17 | 18 | class ltc_call_other_object definition for testing 19 | duration short risk level harmless. 20 | 21 | private section. 22 | data m_cut type ref to zati_if_code_under_test. 23 | 24 | methods setup raising cx_static_check. 25 | methods double_without_framework for testing raising cx_static_check. 26 | 27 | endclass. 28 | 29 | 30 | class ltc_call_other_object implementation. 31 | method setup. 32 | m_cut = zati_cl_factory=>get_code_under_test( ). 33 | endmethod. 34 | 35 | method double_without_framework. 36 | " Self-made Test Double 37 | " Given 38 | final(test_double) = new ltd_depended_on_component( ). 39 | test_double->m_result = 2. 40 | zati_th_injector=>inject_depended_on_component( test_double ). 41 | 42 | " When 43 | final(result) = m_cut->call_other_object( ). 44 | 45 | " Then 46 | cl_abap_unit_assert=>assert_equals( act = result 47 | exp = 2 ). 48 | endmethod. 49 | endclass. 50 | 51 | 52 | class ltc_call_other_object_fw definition for testing 53 | duration short risk level harmless. 54 | 55 | private section. 56 | data m_cut type ref to zati_if_code_under_test. 57 | 58 | methods setup raising cx_static_check. 59 | methods double_with_framework for testing raising cx_static_check. 60 | 61 | endclass. 62 | 63 | 64 | class ltc_call_other_object_fw implementation. 65 | method setup. 66 | m_cut = zati_cl_factory=>get_code_under_test( ). 67 | endmethod. 68 | 69 | method double_with_framework. 70 | " ABAP Object Oriented Test Double Framework 71 | " Given 72 | final(test_double) = cast zati_if_depended_on_component( cl_abap_testdouble=>create( 'ZATI_if_depended_on_component' ) ). 73 | 74 | cl_abap_testdouble=>configure_call( test_double )->returning( 1 ). 75 | 76 | test_double->add( i_summand_1 = 1 77 | i_summand_2 = 2 ). 78 | 79 | zati_th_injector=>inject_depended_on_component( test_double ). 80 | 81 | " When 82 | final(result) = m_cut->call_other_object( ). 83 | 84 | " Then 85 | cl_abap_unit_assert=>assert_equals( act = result 86 | exp = 1 ). 87 | endmethod. 88 | endclass. 89 | 90 | 91 | class ltc_call_function_module definition for testing 92 | duration short risk level harmless. 93 | 94 | private section. 95 | class-data g_function_test_environment type ref to if_function_test_environment. 96 | 97 | class-methods class_setup. 98 | 99 | data m_cut type ref to zati_if_code_under_test. 100 | 101 | methods setup raising cx_static_check. 102 | methods fm_answer_1_expect_1 for testing raising cx_static_check. 103 | methods fm_answer_2_expect_2 for testing raising cx_static_check. 104 | methods fm_answer_a_expect_a for testing raising cx_static_check. 105 | 106 | endclass. 107 | 108 | 109 | class ltc_call_function_module implementation. 110 | method class_setup. 111 | " Function Module Test Double Framework 112 | g_function_test_environment = cl_function_test_environment=>create( value #( ( 'POPUP_TO_CONFIRM' ) ) ). 113 | endmethod. 114 | 115 | method setup. 116 | g_function_test_environment->clear_doubles( ). 117 | m_cut = zati_cl_factory=>get_code_under_test( ). 118 | endmethod. 119 | 120 | method fm_answer_1_expect_1. 121 | " Given 122 | final(test_double) = g_function_test_environment->get_double( 'POPUP_TO_CONFIRM' ). 123 | final(test_double_output_config) = test_double->create_output_configuration( 124 | )->set_exporting_parameter( name = 'ANSWER' 125 | value = 1 ). 126 | test_double->configure_call( )->ignore_all_parameters( 127 | )->then_set_output( test_double_output_config ). 128 | 129 | " When 130 | final(result) = m_cut->call_function_module( ). 131 | 132 | " Then 133 | cl_abap_unit_assert=>assert_equals( act = result 134 | exp = 1 ). 135 | endmethod. 136 | 137 | method fm_answer_2_expect_2. 138 | " Given 139 | final(test_double) = g_function_test_environment->get_double( 'POPUP_TO_CONFIRM' ). 140 | final(test_double_output_config) = test_double->create_output_configuration( 141 | )->set_exporting_parameter( name = 'ANSWER' 142 | value = 2 ). 143 | test_double->configure_call( )->ignore_all_parameters( 144 | )->then_set_output( test_double_output_config ). 145 | 146 | " When 147 | final(result) = m_cut->call_function_module( ). 148 | 149 | " Then 150 | cl_abap_unit_assert=>assert_equals( act = result 151 | exp = 2 ). 152 | endmethod. 153 | 154 | method fm_answer_a_expect_a. 155 | " Given 156 | final(test_double) = g_function_test_environment->get_double( 'POPUP_TO_CONFIRM' ). 157 | final(test_double_output_config) = test_double->create_output_configuration( 158 | )->set_exporting_parameter( name = 'ANSWER' 159 | value = 'A' ). 160 | test_double->configure_call( )->ignore_all_parameters( 161 | )->then_set_output( test_double_output_config ). 162 | 163 | " When 164 | final(result) = m_cut->call_function_module( ). 165 | 166 | " Then 167 | cl_abap_unit_assert=>assert_equals( act = result 168 | exp = 'A' ). 169 | endmethod. 170 | endclass. 171 | 172 | 173 | class ltc_select_database_table definition for testing 174 | duration short risk level harmless. 175 | 176 | private section. 177 | types t_demo_sales_so_i type standard table of demo_sales_so_i with default key. 178 | 179 | class-data g_sql_environment type ref to if_osql_test_environment. 180 | 181 | class-methods class_setup. 182 | class-methods class_teardown. 183 | 184 | data m_cut type ref to zati_if_code_under_test. 185 | 186 | methods setup raising cx_static_check. 187 | methods aggregation for testing raising cx_static_check. 188 | methods empty_table for testing raising cx_static_check. 189 | 190 | endclass. 191 | 192 | 193 | class ltc_select_database_table implementation. 194 | method class_setup. 195 | " ABAP SQL Test Double Framework 196 | g_sql_environment = cl_osql_test_environment=>create( value #( ( 'DEMO_SALES_SO_I' ) ) ). 197 | endmethod. 198 | 199 | method class_teardown. 200 | g_sql_environment->destroy( ). 201 | endmethod. 202 | 203 | method setup. 204 | g_sql_environment->clear_doubles( ). 205 | m_cut = zati_cl_factory=>get_code_under_test( ). 206 | endmethod. 207 | 208 | method aggregation. 209 | " Given 210 | g_sql_environment->insert_test_data( value t_demo_sales_so_i( ( so_item_key = '11' parent_key = '1' ) 211 | ( so_item_key = '12' parent_key = '1' ) 212 | ( so_item_key = '13' parent_key = '1' ) 213 | ( so_item_key = '21' parent_key = '2' ) 214 | ( so_item_key = '31' parent_key = '3' ) ) ). 215 | 216 | " When 217 | final(result) = m_cut->select_database_table( ). 218 | 219 | " Then 220 | cl_abap_unit_assert=>assert_equals( act = lines( result ) 221 | exp = 3 ). 222 | cl_abap_unit_assert=>assert_true( xsdbool( line_exists( result[ salesorder = '1' 223 | itemcount = 3 ] ) ) ). 224 | cl_abap_unit_assert=>assert_true( xsdbool( line_exists( result[ salesorder = '2' 225 | itemcount = 1 ] ) ) ). 226 | cl_abap_unit_assert=>assert_true( xsdbool( line_exists( result[ salesorder = '3' 227 | itemcount = 1 ] ) ) ). 228 | endmethod. 229 | 230 | method empty_table. 231 | " When 232 | final(result) = m_cut->select_database_table( ). 233 | 234 | " Then 235 | cl_abap_unit_assert=>assert_initial( result ). 236 | endmethod. 237 | endclass. 238 | 239 | 240 | class ltc_select_cds_entity definition for testing 241 | duration short risk level harmless. 242 | 243 | private section. 244 | types t_demo_sales_so_i type standard table of demo_sales_so_i with default key. 245 | 246 | class-data g_cds_environment type ref to if_cds_test_environment. 247 | 248 | class-methods class_setup. 249 | class-methods class_teardown. 250 | 251 | data m_cut type ref to zati_if_code_under_test. 252 | 253 | methods setup raising cx_static_check. 254 | methods aggregation for testing raising cx_static_check. 255 | methods empty_table for testing raising cx_static_check. 256 | 257 | endclass. 258 | 259 | 260 | class ltc_select_cds_entity implementation. 261 | method class_setup. 262 | " ABAP CDS Test Double Framework 263 | g_cds_environment = cl_cds_test_environment=>create( 'ZATI_CDS_ENTITY' ). 264 | endmethod. 265 | 266 | method class_teardown. 267 | g_cds_environment->destroy( ). 268 | endmethod. 269 | 270 | method setup. 271 | g_cds_environment->clear_doubles( ). 272 | m_cut = zati_cl_factory=>get_code_under_test( ). 273 | endmethod. 274 | 275 | method aggregation. 276 | " Given 277 | g_cds_environment->insert_test_data( value t_demo_sales_so_i( ( so_item_key = '11' parent_key = '1' ) 278 | ( so_item_key = '12' parent_key = '1' ) 279 | ( so_item_key = '13' parent_key = '1' ) 280 | ( so_item_key = '21' parent_key = '2' ) 281 | ( so_item_key = '31' parent_key = '3' ) ) ). 282 | 283 | " When 284 | final(result) = m_cut->select_cds_entity( ). 285 | 286 | " Then 287 | cl_abap_unit_assert=>assert_equals( act = lines( result ) 288 | exp = 3 ). 289 | cl_abap_unit_assert=>assert_true( xsdbool( line_exists( result[ salesorder = '1' 290 | itemcount = 3 ] ) ) ). 291 | cl_abap_unit_assert=>assert_true( xsdbool( line_exists( result[ salesorder = '2' 292 | itemcount = 1 ] ) ) ). 293 | cl_abap_unit_assert=>assert_true( xsdbool( line_exists( result[ salesorder = '3' 294 | itemcount = 1 ] ) ) ). 295 | endmethod. 296 | 297 | method empty_table. 298 | " When 299 | final(result) = m_cut->select_cds_entity( ). 300 | 301 | " Then 302 | cl_abap_unit_assert=>assert_initial( result ). 303 | endmethod. 304 | endclass. 305 | 306 | 307 | class ltc_call_authority_check definition for testing 308 | duration short risk level harmless. 309 | 310 | private section. 311 | data m_cut type ref to zati_if_code_under_test. 312 | 313 | methods setup raising cx_static_check. 314 | methods display_authorization for testing raising cx_static_check. 315 | methods edit_authorization for testing raising cx_static_check. 316 | 317 | endclass. 318 | 319 | 320 | class ltc_call_authority_check implementation. 321 | method setup. 322 | m_cut = zati_cl_factory=>get_code_under_test( ). 323 | endmethod. 324 | 325 | method display_authorization. 326 | " Classic ABAP Authority Check Test Helper API 327 | " Given 328 | final(develop_authorization) = value cl_aunit_auth_check_types_def=>user_role_authorizations( 329 | ( role_authorizations = value #( 330 | ( object = 'S_DEVELOP' 331 | authorizations = value #( ( value #( ( fieldname = 'ACTVT' 332 | fieldvalues = value #( ( lower_value = '03' ) ) ) ) ) ) ) ) ) ). 333 | 334 | final(authorization_object_set) = cl_aunit_authority_check=>create_auth_object_set( develop_authorization ). 335 | cl_aunit_authority_check=>get_controller( )->restrict_authorizations_to( authorization_object_set ). 336 | 337 | " When 338 | final(result) = m_cut->call_authority_check( ). 339 | 340 | " Then 341 | cl_abap_unit_assert=>assert_equals( act = result 342 | exp = 4 ). 343 | endmethod. 344 | 345 | method edit_authorization. 346 | " Given 347 | final(develop_authorization) = value cl_aunit_auth_check_types_def=>user_role_authorizations( 348 | ( role_authorizations = value #( 349 | ( object = 'S_DEVELOP' 350 | authorizations = value #( ( value #( ( fieldname = 'ACTVT' 351 | fieldvalues = value #( ( lower_value = '02' ) ) ) ) ) ) ) ) ) ). 352 | 353 | final(authorization_object_set) = cl_aunit_authority_check=>create_auth_object_set( develop_authorization ). 354 | cl_aunit_authority_check=>get_controller( )->restrict_authorizations_to( authorization_object_set ). 355 | 356 | " When 357 | final(result) = m_cut->call_authority_check( ). 358 | 359 | " Then 360 | cl_abap_unit_assert=>assert_equals( act = result 361 | exp = 0 ). 362 | endmethod. 363 | endclass. 364 | 365 | 366 | class ltd_fields_handler definition create public for testing. 367 | 368 | public section. 369 | interfaces if_botd_bufdbl_fields_handler. 370 | 371 | private section. 372 | data max_travel_id type /dmo/travel_id value 0. 373 | 374 | endclass. 375 | 376 | 377 | class ltd_fields_handler implementation. 378 | method if_botd_bufdbl_fields_handler~set_readonly_fields. 379 | types ty_create_instances type table for create /dmo/i_travel_m. 380 | 381 | field-symbols type ty_create_instances. 382 | 383 | case entity_name. 384 | when '/DMO/I_TRAVEL_M'. 385 | case operation. 386 | when if_abap_behv=>op-m-create. 387 | assign instances to . 388 | loop at assigning field-symbol(). 389 | max_travel_id += 1. 390 | -travel_id = max_travel_id. 391 | endloop. 392 | endcase. 393 | endcase. 394 | endmethod. 395 | endclass. 396 | 397 | 398 | class ltcl_call_rap_bo_tx_bf_dbl definition final for testing 399 | duration short 400 | risk level harmless. 401 | 402 | private section. 403 | class-data g_rap_buffer_environment type ref to if_botd_txbufdbl_bo_test_env. 404 | 405 | class-methods class_setup. 406 | class-methods class_teardown. 407 | 408 | data m_cut type ref to zati_if_code_under_test. 409 | 410 | methods setup. 411 | methods isolate_create_ba_to_pass for testing raising cx_static_check. 412 | 413 | endclass. 414 | 415 | 416 | class ltcl_call_rap_bo_tx_bf_dbl implementation. 417 | method class_setup. 418 | final(env_config) = cl_botd_txbufdbl_bo_test_env=>prepare_environment_config( 419 | )->set_bdef_dependencies( value #( ( '/DMO/I_TRAVEL_M' ) ) ). 420 | g_rap_buffer_environment = cl_botd_txbufdbl_bo_test_env=>create( env_config ). 421 | endmethod. 422 | 423 | method class_teardown. 424 | g_rap_buffer_environment->destroy( ). 425 | endmethod. 426 | 427 | method setup. 428 | g_rap_buffer_environment->clear_doubles( ). 429 | final(double) = g_rap_buffer_environment->get_test_double( '/DMO/I_TRAVEL_M' ). 430 | double->configure_additional_behavior( )->set_fields_handler( new ltd_fields_handler( ) ). 431 | 432 | m_cut = zati_cl_factory=>get_code_under_test( ). 433 | endmethod. 434 | 435 | method isolate_create_ba_to_pass. 436 | " When 437 | m_cut->call_rap_business_object( importing e_reported = final(reported) 438 | e_failed = final(failed) 439 | e_mapped = final(mapped) ). 440 | 441 | " Then 442 | cl_abap_unit_assert=>assert_initial( reported ). 443 | cl_abap_unit_assert=>assert_initial( failed ). 444 | cl_abap_unit_assert=>assert_not_initial( mapped ). 445 | cl_abap_unit_assert=>assert_initial( mapped-booking ). 446 | cl_abap_unit_assert=>assert_initial( mapped-booksuppl ). 447 | cl_abap_unit_assert=>assert_not_initial( mapped-travel ). 448 | cl_abap_unit_assert=>assert_equals( act = lines( mapped-travel ) exp = 1 ). 449 | endmethod. 450 | endclass. 451 | 452 | 453 | class ltcl_call_rap_bo_mock_eml_api definition final for testing 454 | duration short 455 | risk level harmless. 456 | 457 | private section. 458 | class-data g_mock_eml_api_environment type ref to if_botd_mockemlapi_bo_test_env. 459 | 460 | class-methods class_setup. 461 | class-methods class_teardown. 462 | 463 | data m_cut type ref to zati_if_code_under_test. 464 | 465 | methods setup. 466 | methods isolate_create_ba_to_pass for testing raising cx_static_check. 467 | 468 | endclass. 469 | 470 | 471 | class ltcl_call_rap_bo_mock_eml_api implementation. 472 | method class_setup. 473 | final(env_config) = cl_botd_mockemlapi_bo_test_env=>prepare_environment_config( 474 | )->set_bdef_dependencies( value #( ( '/DMO/I_TRAVEL_M' ) ) ). 475 | g_mock_eml_api_environment = cl_botd_mockemlapi_bo_test_env=>create( env_config ). 476 | endmethod. 477 | 478 | method class_teardown. 479 | g_mock_eml_api_environment->destroy( ). 480 | endmethod. 481 | 482 | method setup. 483 | g_mock_eml_api_environment->clear_doubles( ). 484 | m_cut = zati_cl_factory=>get_code_under_test( ). 485 | endmethod. 486 | 487 | method isolate_create_ba_to_pass. 488 | data mapped_double type response for mapped /dmo/i_travel_m. 489 | 490 | " Given 491 | mapped_double-travel = value #( ( %cid = 'Travel_1' travel_id = '1' ) ). 492 | final(output_config_builder_4_modify) = cl_botd_mockemlapi_bldrfactory=>get_output_config_builder( )->for_modify( ). 493 | final(output) = output_config_builder_4_modify->build_output_for_eml( )->set_mapped( mapped_double ). 494 | final(double) = g_mock_eml_api_environment->get_test_double( '/DMO/I_TRAVEL_M' ). 495 | double->configure_call( )->for_modify( )->ignore_input( )->then_set_output( output ). 496 | 497 | " When 498 | m_cut->call_rap_business_object( importing e_reported = final(reported) 499 | e_failed = final(failed) 500 | e_mapped = final(mapped) ). 501 | " Then 502 | cl_abap_unit_assert=>assert_initial( reported ). 503 | cl_abap_unit_assert=>assert_initial( failed ). 504 | cl_abap_unit_assert=>assert_not_initial( mapped ). 505 | cl_abap_unit_assert=>assert_initial( mapped-booking ). 506 | cl_abap_unit_assert=>assert_initial( mapped-booksuppl ). 507 | cl_abap_unit_assert=>assert_not_initial( mapped-travel ). 508 | cl_abap_unit_assert=>assert_equals( act = lines( mapped-travel ) exp = 1 ). 509 | endmethod. 510 | endclass. 511 | --------------------------------------------------------------------------------