SlideShare a Scribd company logo
1 of 30
Legacy Code
Unit Test
ABAP Test Seams
Referent: Rainer Winkler
Date: 10.06.2017
Unit Test
Test Seam
Legacy Code
code without tests
Michael Feathers
Andrea Goulet
Is it worth the effort to design software well?
https://martinfowler.com/bliki/DesignStaminaHypothesis.html
Test Seams make Unit Tests simpler
Test seams are not the first choice for:
• integration and component tests
as test injections are restricted to the same program
1 Adapted by Klaus Ziegler https://blogs.sap.com/2016/02/06/working-effectively-with-abap-legacy-code-abap-test-seams-are-your-friend/
Test Seams make Unit Tests simpler
Test seams are not the first choice for:
• integration and component tests
as test injections are restricted to the same program
Test seams are expected to be especially useful1 to:
• get legacy code under test
• substitute dependency that shall not get exposed
1 Adapted by Klaus Ziegler https://blogs.sap.com/2016/02/06/working-effectively-with-abap-legacy-code-abap-test-seams-are-your-friend/
Demo 1
Test first
Create methods from test
Test shall first fail „Test the test“
Typical workflow while
changing Legacy Code
Typical workflow while
changing Legacy Code
1 Add Unit test to
- understand
- have a safety belt
Typical workflow while
changing Legacy Code
1 Add Unit test to
- understand
- have a safety belt
2 Refactor to simplify changes
Typical workflow while
changing Legacy Code
1 Add Unit test to
- understand
- have a safety belt
2 Refactor to simplify changes
3 Change Unit test so that it passes
only after changes are made
Typical workflow while
changing Legacy Code
1 Add Unit test to
- understand
- have a safety belt
2 Refactor to simplify changes
3 Change Unit test so that it passes
only after changes are made
4 Make changes in the code
Test to understand
Characterization test
Do not make too many Unit Tests
Try to documentate the logic
New Unit Tests should add a new aspect
Use good names for the tests
Tips
Tips – Test Seams
Read scn blogs
Use local class for testing with static public attributes
Can be used in Unit test and in the injected code
Can not be used in the productive code (as FOR TESTING)
How to inject variable values?
Define a local class for testing
with static public attribute
Empty Seam at place to be checked
Set attribute in injection
Check for value
How to check whether code snippet is executed?
Demo 2 - Preparation
Complex application
Test to understand
Make new Unit Test – The method to test
Make new Unit Test – SE80 -> Display -> UML Class Diagram
Make new Unit Test – SAP2Moose dependencies
Only minor documentation 
Demo 2
Complex application
Test to understand
This tests are also on Github
https://github.com/RainerWinkler/ABAP-Unit-Test-Demo
Synchronized with abapGit (Why not? „Install abapGit make a fork and make a pull request to this“):
Ask me:
Rainer Winkler
Have fun 
No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of CubeServ. The information contained herein may be changed without prior notice.
Some software products marketed by CubeServ and its distributors contain proprietary software components of other software vendors.
Microsoft, Windows, Excel, Outlook, PowerPoint, Silverlight, and Visual Studio are registered trademarks of Microsoft Corporation.
IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x, System z, System z10, z10, z/VM, z/OS, OS/390, zEnterprise,
PowerVM, Power Architecture, Power Systems, POWER7, POWER6+, POWER6, POWER, PowerHA, PureScale, PowerPC, BladeCenter, System Storage, Storwize, XIV, GPFS, HACMP, RETAIN, DB2 Connect, RACF,
Redbooks, OS/2, AIX, Intelligent Miner, WebSphere, Tivoli, Informix, and Smarter Planet are trademarks or registered trademarks of IBM Corporation.
Linux is the registered trademark of Linus Torvalds in the United States and other countries.
Adobe, the Adobe logo, Acrobat, PostScript, and Reader are trademarks or registered trademarks of Adobe Systems Incorporated in the United States and other countries.
Oracle and Java are registered trademarks of Oracle and its affiliates. UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.
Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems Inc.
HTML, XML, XHTML, and W3C are trademarks or registered trademarks of W3C®, World Wide Web Consortium, Massachusetts Institute of Technology.
Apple, App Store, iBooks, iPad, iPhone, iPhoto, iPod, iTunes, Multi-Touch, Objective-C, Retina, Safari, Siri, and Xcode are trademarks or registered trademarks of Apple Inc.
IOS is a registered trademark of Cisco Systems Inc.
RIM, BlackBerry, BBM, BlackBerry Curve, BlackBerry Bold, BlackBerry Pearl, BlackBerry Torch, BlackBerry Storm, BlackBerry Storm2, BlackBerry PlayBook, and BlackBerry App World are trademarks or registered
trademarks of Research in Motion Limited.
Google App Engine, Google Apps, Google Checkout, Google Data API, Google Maps, Google Mobile Ads, Google Mobile Updater, Google Mobile, Google Store, Google Sync, Google Updater, Google Voice, Google Mail,
Gmail, YouTube, Dalvik and Android are trademarks or registered trademarks of Google Inc.
INTERMEC is a registered trademark of Intermec Technologies Corporation. Wi-Fi is a registered trademark of Wi-Fi Alliance. Bluetooth is a registered trademark of Bluetooth SIG Inc. Motorola is a registered trademark of
Motorola Trademark Holdings LLC. Computop is a registered trademark of Computop Wirtschaftsinformatik GmbH.
SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP BusinessObjects Explorer, StreamWork, SAP HANA, and other SAP products and services mentioned herein as well as their respective logos are trademarks or
registered trademarks of SAP AG in Germany and other countries. Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius, and other Business Objects
products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of Business Objects Software Ltd. Business Objects is an SAP company.
Sybase and Adaptive Server, iAnywhere, Sybase 365, SQL Anywhere, and other Sybase products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of Sybase Inc. Sybase
is an SAP company.
Crossgate, m@gic EDDY, B2B 360°, and B2B 360° Services are registered trademarks of Crossgate AG in Germany and other countries. Crossgate is an SAP company.
All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.
The information in this document is proprietary to CubeServ. No part of this document may be reproduced, copied, or transmitted in any form or for any purpose without the express prior written permission of CubeServ.
ALLE RECHTE VORBEHALTEN
ALL RIGHTS RESERVED, COPYRIGHT 2016 – CubeServ AG

More Related Content

What's hot

Marcel Hild - Spryker (e)commerce framework als Alternative zu traditioneller...
Marcel Hild - Spryker (e)commerce framework als Alternative zu traditioneller...Marcel Hild - Spryker (e)commerce framework als Alternative zu traditioneller...
Marcel Hild - Spryker (e)commerce framework als Alternative zu traditioneller...AboutYouGmbH
 
DevGeekWeek 2017 Inflectra Meetup in Herzliya Presentation
DevGeekWeek 2017 Inflectra Meetup in Herzliya PresentationDevGeekWeek 2017 Inflectra Meetup in Herzliya Presentation
DevGeekWeek 2017 Inflectra Meetup in Herzliya PresentationAdam Sandman
 
Open sap ui51_week0_all_slides
Open sap ui51_week0_all_slidesOpen sap ui51_week0_all_slides
Open sap ui51_week0_all_slidesSUNIL KUMAR REDDY
 
UI5 Apps beyond the office (UI5con)
UI5 Apps beyond the office (UI5con)UI5 Apps beyond the office (UI5con)
UI5 Apps beyond the office (UI5con)Denny Schreber
 
Spring Tools 4 - Eclipse and Beyond
Spring Tools 4 - Eclipse and BeyondSpring Tools 4 - Eclipse and Beyond
Spring Tools 4 - Eclipse and BeyondVMware Tanzu
 
Java magazine from big data to insights
Java magazine from big data to insightsJava magazine from big data to insights
Java magazine from big data to insightsmustafa sarac
 
Javamagazine Mayo Junio 2013
Javamagazine Mayo Junio 2013Javamagazine Mayo Junio 2013
Javamagazine Mayo Junio 2013Erik Gur
 
Java Magazine Enterprise September /October2016
Java Magazine Enterprise September /October2016Java Magazine Enterprise September /October2016
Java Magazine Enterprise September /October2016Erik Gur
 
Java magazine january february 2017
Java magazine january february 2017Java magazine january february 2017
Java magazine january february 2017mustafa sarac
 
The i7 Framework for System-i
The i7 Framework for System-iThe i7 Framework for System-i
The i7 Framework for System-iIvo Jansch
 

What's hot (10)

Marcel Hild - Spryker (e)commerce framework als Alternative zu traditioneller...
Marcel Hild - Spryker (e)commerce framework als Alternative zu traditioneller...Marcel Hild - Spryker (e)commerce framework als Alternative zu traditioneller...
Marcel Hild - Spryker (e)commerce framework als Alternative zu traditioneller...
 
DevGeekWeek 2017 Inflectra Meetup in Herzliya Presentation
DevGeekWeek 2017 Inflectra Meetup in Herzliya PresentationDevGeekWeek 2017 Inflectra Meetup in Herzliya Presentation
DevGeekWeek 2017 Inflectra Meetup in Herzliya Presentation
 
Open sap ui51_week0_all_slides
Open sap ui51_week0_all_slidesOpen sap ui51_week0_all_slides
Open sap ui51_week0_all_slides
 
UI5 Apps beyond the office (UI5con)
UI5 Apps beyond the office (UI5con)UI5 Apps beyond the office (UI5con)
UI5 Apps beyond the office (UI5con)
 
Spring Tools 4 - Eclipse and Beyond
Spring Tools 4 - Eclipse and BeyondSpring Tools 4 - Eclipse and Beyond
Spring Tools 4 - Eclipse and Beyond
 
Java magazine from big data to insights
Java magazine from big data to insightsJava magazine from big data to insights
Java magazine from big data to insights
 
Javamagazine Mayo Junio 2013
Javamagazine Mayo Junio 2013Javamagazine Mayo Junio 2013
Javamagazine Mayo Junio 2013
 
Java Magazine Enterprise September /October2016
Java Magazine Enterprise September /October2016Java Magazine Enterprise September /October2016
Java Magazine Enterprise September /October2016
 
Java magazine january february 2017
Java magazine january february 2017Java magazine january february 2017
Java magazine january february 2017
 
The i7 Framework for System-i
The i7 Framework for System-iThe i7 Framework for System-i
The i7 Framework for System-i
 

Similar to Unit Tests and Test Seams for abap Hamburg June 2017 presented

Effective load testing_&_monitoring
Effective load testing_&_monitoringEffective load testing_&_monitoring
Effective load testing_&_monitoringganesh_barcamp
 
Design evolution of SAP Business ByDesign - Document Editor
Design evolution of SAP Business ByDesign - Document EditorDesign evolution of SAP Business ByDesign - Document Editor
Design evolution of SAP Business ByDesign - Document EditorChristian Happel
 
SAST for JavaScript: A Brief Overview of Commercial Tools
SAST for JavaScript: A Brief Overview of Commercial ToolsSAST for JavaScript: A Brief Overview of Commercial Tools
SAST for JavaScript: A Brief Overview of Commercial ToolsAchim D. Brucker
 
Do Visualizations help during development? Using Moose while coding.
Do Visualizations help during development? Using Moose while coding.Do Visualizations help during development? Using Moose while coding.
Do Visualizations help during development? Using Moose while coding.ESUG
 
Design evolution SAP Business ByDesign - Work Center Overview
Design evolution SAP Business ByDesign  - Work Center OverviewDesign evolution SAP Business ByDesign  - Work Center Overview
Design evolution SAP Business ByDesign - Work Center OverviewChristian Happel
 
Преимущества бесшовной интеграции документов с бизнес-процессами в SAP ERP
Преимущества бесшовной интеграции документов с бизнес-процессами в SAP ERPПреимущества бесшовной интеграции документов с бизнес-процессами в SAP ERP
Преимущества бесшовной интеграции документов с бизнес-процессами в SAP ERPLANIT
 
Ppf in sap_ewm_1
Ppf in sap_ewm_1Ppf in sap_ewm_1
Ppf in sap_ewm_1Yuan Lin
 
Sa fe 4.0 implementing Enterprise Agile using the Scaled Agile Framework
Sa fe 4.0   implementing Enterprise Agile using the Scaled Agile FrameworkSa fe 4.0   implementing Enterprise Agile using the Scaled Agile Framework
Sa fe 4.0 implementing Enterprise Agile using the Scaled Agile Frameworkevatjohnson
 
SAFe 4.0 - implementing Enterprise Agile using the Scaled Agile Framework
SAFe 4.0 -   implementing Enterprise Agile using the Scaled Agile FrameworkSAFe 4.0 -   implementing Enterprise Agile using the Scaled Agile Framework
SAFe 4.0 - implementing Enterprise Agile using the Scaled Agile FrameworkIntland Software GmbH
 
UI5 Tooling & Ecosystem
UI5 Tooling & EcosystemUI5 Tooling & Ecosystem
UI5 Tooling & EcosystemPeter Muessig
 
101 erp605 process_overview_en_in
101 erp605 process_overview_en_in101 erp605 process_overview_en_in
101 erp605 process_overview_en_insatishkr14
 
101 erp605 process_overview_en_in
101 erp605 process_overview_en_in101 erp605 process_overview_en_in
101 erp605 process_overview_en_inSergio Bobadilha
 
SAP NetWeaver Application Server Add-On for Code Vulnerability Analysis Overview
SAP NetWeaver Application Server Add-On for Code Vulnerability Analysis OverviewSAP NetWeaver Application Server Add-On for Code Vulnerability Analysis Overview
SAP NetWeaver Application Server Add-On for Code Vulnerability Analysis OverviewSAP Technology
 
Dev ops for z
Dev ops for z Dev ops for z
Dev ops for z bamadhu
 

Similar to Unit Tests and Test Seams for abap Hamburg June 2017 presented (20)

Effective load testing_&_monitoring
Effective load testing_&_monitoringEffective load testing_&_monitoring
Effective load testing_&_monitoring
 
Design evolution of SAP Business ByDesign - Document Editor
Design evolution of SAP Business ByDesign - Document EditorDesign evolution of SAP Business ByDesign - Document Editor
Design evolution of SAP Business ByDesign - Document Editor
 
SAST for JavaScript: A Brief Overview of Commercial Tools
SAST for JavaScript: A Brief Overview of Commercial ToolsSAST for JavaScript: A Brief Overview of Commercial Tools
SAST for JavaScript: A Brief Overview of Commercial Tools
 
Do Visualizations help during development? Using Moose while coding.
Do Visualizations help during development? Using Moose while coding.Do Visualizations help during development? Using Moose while coding.
Do Visualizations help during development? Using Moose while coding.
 
Design evolution SAP Business ByDesign - Work Center Overview
Design evolution SAP Business ByDesign  - Work Center OverviewDesign evolution SAP Business ByDesign  - Work Center Overview
Design evolution SAP Business ByDesign - Work Center Overview
 
Sap CI EHP 6
Sap CI EHP 6Sap CI EHP 6
Sap CI EHP 6
 
Преимущества бесшовной интеграции документов с бизнес-процессами в SAP ERP
Преимущества бесшовной интеграции документов с бизнес-процессами в SAP ERPПреимущества бесшовной интеграции документов с бизнес-процессами в SAP ERP
Преимущества бесшовной интеграции документов с бизнес-процессами в SAP ERP
 
Ppf in sap_ewm_1
Ppf in sap_ewm_1Ppf in sap_ewm_1
Ppf in sap_ewm_1
 
Cookbook dropdown crm2007
Cookbook dropdown crm2007Cookbook dropdown crm2007
Cookbook dropdown crm2007
 
Sa fe 4.0 implementing Enterprise Agile using the Scaled Agile Framework
Sa fe 4.0   implementing Enterprise Agile using the Scaled Agile FrameworkSa fe 4.0   implementing Enterprise Agile using the Scaled Agile Framework
Sa fe 4.0 implementing Enterprise Agile using the Scaled Agile Framework
 
SAFe 4.0 - implementing Enterprise Agile using the Scaled Agile Framework
SAFe 4.0 -   implementing Enterprise Agile using the Scaled Agile FrameworkSAFe 4.0 -   implementing Enterprise Agile using the Scaled Agile Framework
SAFe 4.0 - implementing Enterprise Agile using the Scaled Agile Framework
 
SAP HANA
SAP HANASAP HANA
SAP HANA
 
UI5 Tooling & Ecosystem
UI5 Tooling & EcosystemUI5 Tooling & Ecosystem
UI5 Tooling & Ecosystem
 
Narayana
NarayanaNarayana
Narayana
 
SAP HANA Cloud – Virtual Bootcamp: How to use the HANA Persistence Se…
SAP HANA Cloud – Virtual Bootcamp: How to use the HANA Persistence Se…SAP HANA Cloud – Virtual Bootcamp: How to use the HANA Persistence Se…
SAP HANA Cloud – Virtual Bootcamp: How to use the HANA Persistence Se…
 
101 erp605 process_overview_en_in
101 erp605 process_overview_en_in101 erp605 process_overview_en_in
101 erp605 process_overview_en_in
 
101 erp605 process_overview_en_in
101 erp605 process_overview_en_in101 erp605 process_overview_en_in
101 erp605 process_overview_en_in
 
SAP NetWeaver Application Server Add-On for Code Vulnerability Analysis Overview
SAP NetWeaver Application Server Add-On for Code Vulnerability Analysis OverviewSAP NetWeaver Application Server Add-On for Code Vulnerability Analysis Overview
SAP NetWeaver Application Server Add-On for Code Vulnerability Analysis Overview
 
IBM Z for the Digital Enterprise - DevOps for Z
IBM Z for the Digital Enterprise - DevOps for Z IBM Z for the Digital Enterprise - DevOps for Z
IBM Z for the Digital Enterprise - DevOps for Z
 
Dev ops for z
Dev ops for z Dev ops for z
Dev ops for z
 

Recently uploaded

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 

Recently uploaded (20)

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

Unit Tests and Test Seams for abap Hamburg June 2017 presented

  • 1. Legacy Code Unit Test ABAP Test Seams Referent: Rainer Winkler Date: 10.06.2017
  • 3. Legacy Code code without tests Michael Feathers
  • 5. Is it worth the effort to design software well? https://martinfowler.com/bliki/DesignStaminaHypothesis.html
  • 6. Test Seams make Unit Tests simpler Test seams are not the first choice for: • integration and component tests as test injections are restricted to the same program 1 Adapted by Klaus Ziegler https://blogs.sap.com/2016/02/06/working-effectively-with-abap-legacy-code-abap-test-seams-are-your-friend/
  • 7. Test Seams make Unit Tests simpler Test seams are not the first choice for: • integration and component tests as test injections are restricted to the same program Test seams are expected to be especially useful1 to: • get legacy code under test • substitute dependency that shall not get exposed 1 Adapted by Klaus Ziegler https://blogs.sap.com/2016/02/06/working-effectively-with-abap-legacy-code-abap-test-seams-are-your-friend/
  • 8. Demo 1 Test first Create methods from test Test shall first fail „Test the test“
  • 10. Typical workflow while changing Legacy Code 1 Add Unit test to - understand - have a safety belt
  • 11. Typical workflow while changing Legacy Code 1 Add Unit test to - understand - have a safety belt 2 Refactor to simplify changes
  • 12. Typical workflow while changing Legacy Code 1 Add Unit test to - understand - have a safety belt 2 Refactor to simplify changes 3 Change Unit test so that it passes only after changes are made
  • 13. Typical workflow while changing Legacy Code 1 Add Unit test to - understand - have a safety belt 2 Refactor to simplify changes 3 Change Unit test so that it passes only after changes are made 4 Make changes in the code
  • 16. Do not make too many Unit Tests Try to documentate the logic New Unit Tests should add a new aspect Use good names for the tests Tips
  • 17. Tips – Test Seams
  • 19. Use local class for testing with static public attributes Can be used in Unit test and in the injected code Can not be used in the productive code (as FOR TESTING) How to inject variable values?
  • 20. Define a local class for testing with static public attribute Empty Seam at place to be checked Set attribute in injection Check for value How to check whether code snippet is executed?
  • 21. Demo 2 - Preparation Complex application Test to understand
  • 22. Make new Unit Test – The method to test
  • 23. Make new Unit Test – SE80 -> Display -> UML Class Diagram
  • 24. Make new Unit Test – SAP2Moose dependencies
  • 27. This tests are also on Github https://github.com/RainerWinkler/ABAP-Unit-Test-Demo Synchronized with abapGit (Why not? „Install abapGit make a fork and make a pull request to this“):
  • 30. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of CubeServ. The information contained herein may be changed without prior notice. Some software products marketed by CubeServ and its distributors contain proprietary software components of other software vendors. Microsoft, Windows, Excel, Outlook, PowerPoint, Silverlight, and Visual Studio are registered trademarks of Microsoft Corporation. IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x, System z, System z10, z10, z/VM, z/OS, OS/390, zEnterprise, PowerVM, Power Architecture, Power Systems, POWER7, POWER6+, POWER6, POWER, PowerHA, PureScale, PowerPC, BladeCenter, System Storage, Storwize, XIV, GPFS, HACMP, RETAIN, DB2 Connect, RACF, Redbooks, OS/2, AIX, Intelligent Miner, WebSphere, Tivoli, Informix, and Smarter Planet are trademarks or registered trademarks of IBM Corporation. Linux is the registered trademark of Linus Torvalds in the United States and other countries. Adobe, the Adobe logo, Acrobat, PostScript, and Reader are trademarks or registered trademarks of Adobe Systems Incorporated in the United States and other countries. Oracle and Java are registered trademarks of Oracle and its affiliates. UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group. Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems Inc. HTML, XML, XHTML, and W3C are trademarks or registered trademarks of W3C®, World Wide Web Consortium, Massachusetts Institute of Technology. Apple, App Store, iBooks, iPad, iPhone, iPhoto, iPod, iTunes, Multi-Touch, Objective-C, Retina, Safari, Siri, and Xcode are trademarks or registered trademarks of Apple Inc. IOS is a registered trademark of Cisco Systems Inc. RIM, BlackBerry, BBM, BlackBerry Curve, BlackBerry Bold, BlackBerry Pearl, BlackBerry Torch, BlackBerry Storm, BlackBerry Storm2, BlackBerry PlayBook, and BlackBerry App World are trademarks or registered trademarks of Research in Motion Limited. Google App Engine, Google Apps, Google Checkout, Google Data API, Google Maps, Google Mobile Ads, Google Mobile Updater, Google Mobile, Google Store, Google Sync, Google Updater, Google Voice, Google Mail, Gmail, YouTube, Dalvik and Android are trademarks or registered trademarks of Google Inc. INTERMEC is a registered trademark of Intermec Technologies Corporation. Wi-Fi is a registered trademark of Wi-Fi Alliance. Bluetooth is a registered trademark of Bluetooth SIG Inc. Motorola is a registered trademark of Motorola Trademark Holdings LLC. Computop is a registered trademark of Computop Wirtschaftsinformatik GmbH. SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP BusinessObjects Explorer, StreamWork, SAP HANA, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and other countries. Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius, and other Business Objects products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of Business Objects Software Ltd. Business Objects is an SAP company. Sybase and Adaptive Server, iAnywhere, Sybase 365, SQL Anywhere, and other Sybase products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of Sybase Inc. Sybase is an SAP company. Crossgate, m@gic EDDY, B2B 360°, and B2B 360° Services are registered trademarks of Crossgate AG in Germany and other countries. Crossgate is an SAP company. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary. The information in this document is proprietary to CubeServ. No part of this document may be reproduced, copied, or transmitted in any form or for any purpose without the express prior written permission of CubeServ. ALLE RECHTE VORBEHALTEN ALL RIGHTS RESERVED, COPYRIGHT 2016 – CubeServ AG