SlideShare a Scribd company logo
1 of 36
Download to read offline
TDD in the ABAP World
Hendrik Neumann

#sitNL 2013

© 2013 evivax IT Consulting GmbH
Agenda

(1) Unit Testing & ABAP Unit
(2) Test Driven Development (TDD)
(3) Live Coding
Unit Testing & ABAP Unit

© 2013 evivax IT Consulting GmbH
Unit Testing

Definition
Unit Testing
Unit Testing is a method by which
individual units of source code are
tested to determine if they are fit
to use.
Unit Testing
Unit Testing is a method by which
individual units are e.g.ource code
fittMethods of t
Methods

Function Modules

fit Function Groups
fiMoModule Pools
Function
Functn Reports
Unit Testing
aim:
Find bugs early
Write once, run often
Effective Tests must be automated
solution:
xUnit Frameworks
xUnit Framework

Definition
xUnit Framework
Provides an automated solution with
no need to write the same tests
many times and no need to remember
what should be the result of each
test.
xUnit Framework

How does it work?
xUnit Framework

setup()
Create object under test
common to all tests.
xUnit Framework
Call Clear up
object under test
– e.g. a mess.. method
public
your
with test data.

setup()  test_method()
xUnit Framework
assert_*()–methods

setup()  test_method()
Verify output of object
under test using xUnit‘s
assert methods
xUnit Framework
Clear up
your mess..

setup()  test_method()teardown()
xUnit Framework
test_method()
test_method()
test_method()
setup()  test_method()teardown()
test_method()
test_method()
test_method()
ABAP Unit

© 2013 evivax IT Consulting GmbH
ABAP Unit
SAP‘s xUnit implemenation
ABAP Unit
Local test classes for global
development artifacts
In Reports, Function Modules and
Classes
Not acitve on production systems
ABAP Unit
• Tools integration:
– ABAP Workbench
– Code Inspector Integration
– ABAP Unit Browser
– ABAP Test Cockpit (ATC)
– ABAP in Eclipse
Test Driven Development

© 2013 evivax IT Consulting GmbH
Test Driven Development
When do you write your Unit Tests?
• Never
• After you wrote your code
• Before you write your code
Test Driven Development
When do you write your Unit Tests?
• Never
• After you wrote your code
• Before you write your code
Test Driven Development
Test Driven Development

Test 1st
Test Cycle

Test
Write a test that expresses how you’ll
use the code and what you need it to do.
Test Cycle

Test
Write enough code to
get the test to pass,
but no more.

Code
Test Cycle

Test
Refactor

Clean up the code to
remove redundancy and
improve the design.

Code
Test Cycle

Test
Refactor

Code
Test Cycle

Refactor
Code

Test
Test Cycle

Code
Test

Refactor
Test Cycle

Test
Refactor

Code
Code Kata: Roman Numerals
Rules:
•
•
•
•

smaller number in front of a larger number  subtraction
all else  addition
put only one smaller number in front of a larger number
ones, tens, hundreds and thousands are separate items

I

The numeral one. II is two, III is three.

V

The numeral 5. IV is 4, VI is 6, VII is 7, VIII is 8.

X

The numeral 10. IX is 9, XI is 11, etc.

L

The numeral 50. XL would be 40.

C

The numeral 100. C is short for the Latin word Centum,
but Century is eaysier to remember ;-)

D

The numeral 500.

M

The numeral 1000.
So Long, and Thanks for
All the Fish
Any Qs?

© 2013 evivax IT Consulting GmbH
Green Bar Patterns
(hidden track)

© 2013 evivax IT Consulting GmbH
Green Bar Patterns
Fake it till you make it
• Start with hardcoded results and
wait until tests force them to
become real
Green Bar Patterns
Triangulate To Abstraction
• Make the code abstract only when
you have two or more examples
Green Bar Patterns
Obvious Implementation
• aka Don‘t be stupid
• If you really know the right way
to implement it, do it that way

More Related Content

What's hot

Unit Testing And Mocking
Unit Testing And MockingUnit Testing And Mocking
Unit Testing And Mocking
Joe Wilson
 
Software Testing Tecniques
Software Testing TecniquesSoftware Testing Tecniques
Software Testing Tecniques
ersanbilik
 

What's hot (19)

Practical unit testing in c & c++
Practical unit testing in c & c++Practical unit testing in c & c++
Practical unit testing in c & c++
 
Unit tests benefits
Unit tests benefitsUnit tests benefits
Unit tests benefits
 
Unit Testing And Mocking
Unit Testing And MockingUnit Testing And Mocking
Unit Testing And Mocking
 
Unit Testing in Action - C#, NUnit, and Moq
Unit Testing in Action - C#, NUnit, and MoqUnit Testing in Action - C#, NUnit, and Moq
Unit Testing in Action - C#, NUnit, and Moq
 
Unit Testing
Unit TestingUnit Testing
Unit Testing
 
Unit testing
Unit testing Unit testing
Unit testing
 
An Introduction to Unit Testing
An Introduction to Unit TestingAn Introduction to Unit Testing
An Introduction to Unit Testing
 
Unit tests & TDD
Unit tests & TDDUnit tests & TDD
Unit tests & TDD
 
An Introduction to Unit Testing
An Introduction to Unit TestingAn Introduction to Unit Testing
An Introduction to Unit Testing
 
Tdd
TddTdd
Tdd
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Software Testing Tecniques
Software Testing TecniquesSoftware Testing Tecniques
Software Testing Tecniques
 
Debugging
DebuggingDebugging
Debugging
 
Pair programming and introduction to TDD
Pair programming and introduction to TDDPair programming and introduction to TDD
Pair programming and introduction to TDD
 
Software Quality via Unit Testing
Software Quality via Unit TestingSoftware Quality via Unit Testing
Software Quality via Unit Testing
 
Topic production code
Topic production codeTopic production code
Topic production code
 
Testing the untestable
Testing the untestableTesting the untestable
Testing the untestable
 
Understanding Unit Testing
Understanding Unit TestingUnderstanding Unit Testing
Understanding Unit Testing
 
Unit and integration Testing
Unit and integration TestingUnit and integration Testing
Unit and integration Testing
 

Viewers also liked (7)

ABAP Unit and TDD
ABAP Unit and TDDABAP Unit and TDD
ABAP Unit and TDD
 
ABAPCodeRetreat 23.7.2016 - Unit Testing
ABAPCodeRetreat 23.7.2016 - Unit TestingABAPCodeRetreat 23.7.2016 - Unit Testing
ABAPCodeRetreat 23.7.2016 - Unit Testing
 
The best debugging tool - your brain
The best debugging tool - your brainThe best debugging tool - your brain
The best debugging tool - your brain
 
ABAPCodeRetreat - ABAP PUSH CHANNELS and SAP FIORI
ABAPCodeRetreat -   ABAP PUSH CHANNELS and SAP FIORIABAPCodeRetreat -   ABAP PUSH CHANNELS and SAP FIORI
ABAPCodeRetreat - ABAP PUSH CHANNELS and SAP FIORI
 
ABAPCodeRetreat 23.7.2016 - Abap in Eclipse
ABAPCodeRetreat 23.7.2016 - Abap in EclipseABAPCodeRetreat 23.7.2016 - Abap in Eclipse
ABAPCodeRetreat 23.7.2016 - Abap in Eclipse
 
ABAP T codes
ABAP T codesABAP T codes
ABAP T codes
 
ABAPCodeRetreat 23.7.2016 - TDD
ABAPCodeRetreat 23.7.2016 - TDDABAPCodeRetreat 23.7.2016 - TDD
ABAPCodeRetreat 23.7.2016 - TDD
 

Similar to TDD in the ABAP world - sitNL 2013 edition

Test Driven iOS Development (TDD)
Test Driven iOS Development (TDD)Test Driven iOS Development (TDD)
Test Driven iOS Development (TDD)
Babul Mirdha
 
Test-Driven Development Reference Card
Test-Driven Development Reference CardTest-Driven Development Reference Card
Test-Driven Development Reference Card
Seapine Software
 
Test-Driven Development
Test-Driven DevelopmentTest-Driven Development
Test-Driven Development
Meilan Ou
 

Similar to TDD in the ABAP world - sitNL 2013 edition (20)

ABAPCodeRetreat Frankfurt 2016 - TDD with ABAP
ABAPCodeRetreat Frankfurt 2016 - TDD with ABAPABAPCodeRetreat Frankfurt 2016 - TDD with ABAP
ABAPCodeRetreat Frankfurt 2016 - TDD with ABAP
 
Unit Testing in R with Testthat - HRUG
Unit Testing in R with Testthat - HRUGUnit Testing in R with Testthat - HRUG
Unit Testing in R with Testthat - HRUG
 
Test Driven iOS Development (TDD)
Test Driven iOS Development (TDD)Test Driven iOS Development (TDD)
Test Driven iOS Development (TDD)
 
TDD reloaded - JUGTAA 24 Ottobre 2012
TDD reloaded - JUGTAA 24 Ottobre 2012TDD reloaded - JUGTAA 24 Ottobre 2012
TDD reloaded - JUGTAA 24 Ottobre 2012
 
EKON 23 Code_review_checklist
EKON 23 Code_review_checklistEKON 23 Code_review_checklist
EKON 23 Code_review_checklist
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
NET Code Testing
NET Code TestingNET Code Testing
NET Code Testing
 
Binary Studio Academy: .NET Code Testing
Binary Studio Academy: .NET Code TestingBinary Studio Academy: .NET Code Testing
Binary Studio Academy: .NET Code Testing
 
Test-Driven Development Reference Card
Test-Driven Development Reference CardTest-Driven Development Reference Card
Test-Driven Development Reference Card
 
An Introduction To Software Development - Test Driven Development, Part 1
An Introduction To Software Development - Test Driven Development, Part 1An Introduction To Software Development - Test Driven Development, Part 1
An Introduction To Software Development - Test Driven Development, Part 1
 
Microsoft Fakes, Unit Testing the (almost) Untestable Code
Microsoft Fakes, Unit Testing the (almost) Untestable CodeMicrosoft Fakes, Unit Testing the (almost) Untestable Code
Microsoft Fakes, Unit Testing the (almost) Untestable Code
 
Unit Tests with Microsoft Fakes
Unit Tests with Microsoft FakesUnit Tests with Microsoft Fakes
Unit Tests with Microsoft Fakes
 
TDD and Related Techniques for Non Developers (2012)
TDD and Related Techniques for Non Developers (2012)TDD and Related Techniques for Non Developers (2012)
TDD and Related Techniques for Non Developers (2012)
 
Test-Driven Development
Test-Driven DevelopmentTest-Driven Development
Test-Driven Development
 
Unit Testing and Tools
Unit Testing and ToolsUnit Testing and Tools
Unit Testing and Tools
 
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in FlexassertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
 
Unit Testing
Unit TestingUnit Testing
Unit Testing
 
Python and test
Python and testPython and test
Python and test
 
Getting started with Test Driven Development
Getting started with Test Driven DevelopmentGetting started with Test Driven Development
Getting started with Test Driven Development
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 

Recently uploaded

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Recently uploaded (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
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...
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
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
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 

TDD in the ABAP world - sitNL 2013 edition