Your SlideShare is downloading. ×
TDD in the ABAP world - sitNL 2013 edition
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

TDD in the ABAP world - sitNL 2013 edition

782
views

Published on

Test Driven Development with ABAP Unit. The SAP Inside Track Netherlands 2013 edition.

Test Driven Development with ABAP Unit. The SAP Inside Track Netherlands 2013 edition.

Published in: Technology, Education

0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
782
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
6
Comments
0
Likes
3
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. TDD in the ABAP World Hendrik Neumann #sitNL 2013 © 2013 evivax IT Consulting GmbH
  • 2. Agenda (1) Unit Testing & ABAP Unit (2) Test Driven Development (TDD) (3) Live Coding
  • 3. Unit Testing & ABAP Unit © 2013 evivax IT Consulting GmbH
  • 4. Unit Testing Definition
  • 5. Unit Testing Unit Testing is a method by which individual units of source code are tested to determine if they are fit to use.
  • 6. 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
  • 7. Unit Testing aim: Find bugs early Write once, run often Effective Tests must be automated solution: xUnit Frameworks
  • 8. xUnit Framework Definition
  • 9. 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.
  • 10. xUnit Framework How does it work?
  • 11. xUnit Framework setup() Create object under test common to all tests.
  • 12. xUnit Framework Call Clear up object under test – e.g. a mess.. method public your with test data. setup()  test_method()
  • 13. xUnit Framework assert_*()–methods setup()  test_method() Verify output of object under test using xUnit‘s assert methods
  • 14. xUnit Framework Clear up your mess.. setup()  test_method()teardown()
  • 15. xUnit Framework test_method() test_method() test_method() setup()  test_method()teardown() test_method() test_method() test_method()
  • 16. ABAP Unit © 2013 evivax IT Consulting GmbH
  • 17. ABAP Unit SAP‘s xUnit implemenation
  • 18. ABAP Unit Local test classes for global development artifacts In Reports, Function Modules and Classes Not acitve on production systems
  • 19. ABAP Unit • Tools integration: – ABAP Workbench – Code Inspector Integration – ABAP Unit Browser – ABAP Test Cockpit (ATC) – ABAP in Eclipse
  • 20. Test Driven Development © 2013 evivax IT Consulting GmbH
  • 21. Test Driven Development When do you write your Unit Tests? • Never • After you wrote your code • Before you write your code
  • 22. Test Driven Development When do you write your Unit Tests? • Never • After you wrote your code • Before you write your code Test Driven Development
  • 23. Test Driven Development Test 1st
  • 24. Test Cycle Test Write a test that expresses how you’ll use the code and what you need it to do.
  • 25. Test Cycle Test Write enough code to get the test to pass, but no more. Code
  • 26. Test Cycle Test Refactor Clean up the code to remove redundancy and improve the design. Code
  • 27. Test Cycle Test Refactor Code
  • 28. Test Cycle Refactor Code Test
  • 29. Test Cycle Code Test Refactor
  • 30. Test Cycle Test Refactor Code
  • 31. 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.
  • 32. So Long, and Thanks for All the Fish Any Qs? © 2013 evivax IT Consulting GmbH
  • 33. Green Bar Patterns (hidden track) © 2013 evivax IT Consulting GmbH
  • 34. Green Bar Patterns Fake it till you make it • Start with hardcoded results and wait until tests force them to become real
  • 35. Green Bar Patterns Triangulate To Abstraction • Make the code abstract only when you have two or more examples
  • 36. Green Bar Patterns Obvious Implementation • aka Don‘t be stupid • If you really know the right way to implement it, do it that way