SlideShare a Scribd company logo
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 Presentation
Adam Sandman
 
Open sap ui51_week0_all_slides
Open sap ui51_week0_all_slidesOpen sap ui51_week0_all_slides
Open sap ui51_week0_all_slides
SUNIL 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 Beyond
VMware 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 insights
mustafa sarac
 
Javamagazine Mayo Junio 2013
Javamagazine Mayo Junio 2013Javamagazine Mayo Junio 2013
Javamagazine Mayo Junio 2013
Erik Gur
 
Java Magazine Enterprise September /October2016
Java Magazine Enterprise September /October2016Java Magazine Enterprise September /October2016
Java Magazine Enterprise September /October2016
Erik Gur
 
Java magazine january february 2017
Java magazine january february 2017Java magazine january february 2017
Java magazine january february 2017
mustafa sarac
 
The i7 Framework for System-i
The i7 Framework for System-iThe i7 Framework for System-i
The i7 Framework for System-i
Ivo 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_&_monitoring
ganesh_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 Editor
Christian 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 Tools
Achim 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 Overview
Christian Happel
 
Sap CI EHP 6
Sap CI EHP 6Sap CI EHP 6
Sap CI EHP 6
Srinivas Gudimella
 
Преимущества бесшовной интеграции документов с бизнес-процессами в SAP ERP
Преимущества бесшовной интеграции документов с бизнес-процессами в SAP ERPПреимущества бесшовной интеграции документов с бизнес-процессами в SAP ERP
Преимущества бесшовной интеграции документов с бизнес-процессами в SAP ERP
LANIT
 
Ppf in sap_ewm_1
Ppf in sap_ewm_1Ppf in sap_ewm_1
Ppf in sap_ewm_1
Yuan Lin
 
Cookbook dropdown crm2007
Cookbook dropdown crm2007Cookbook dropdown crm2007
Cookbook dropdown crm2007
Ripunjay Rathaur
 
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
evatjohnson
 
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
Intland Software GmbH
 
SAP HANA
SAP HANASAP HANA
UI5 Tooling & Ecosystem
UI5 Tooling & EcosystemUI5 Tooling & Ecosystem
UI5 Tooling & Ecosystem
Peter Muessig
 
Narayana
NarayanaNarayana
Narayana
Narayana Golla
 
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…
SAP PartnerEdge program for Application Development
 
101 erp605 process_overview_en_in
101 erp605 process_overview_en_in101 erp605 process_overview_en_in
101 erp605 process_overview_en_in
Sergio Bobadilha
 
101 erp605 process_overview_en_in
101 erp605 process_overview_en_in101 erp605 process_overview_en_in
101 erp605 process_overview_en_in
satishkr14
 
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
SAP Technology
 
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
DevOps for Enterprise Systems
 
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

National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
Zilliz
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 

Recently uploaded (20)

National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 

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