ABAP Unit and TDD

1,859 views

Published on

Introduction into Test Driven Development (TDD) with ABAP Unit.

Presented at SAP Inside Track Hamburg (sitHH) 2013: http://wiki.sdn.sap.com/wiki/display/events/SAP+Inside+Track+Hamburg+2013

Published in: Technology, Business
1 Comment
1 Like
Statistics
Notes
No Downloads
Views
Total views
1,859
On SlideShare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
25
Comments
1
Likes
1
Embeds 0
No embeds

No notes for slide

ABAP Unit and TDD

  1. 1. ABAP Unit and TDDHendrik NeumannSAP Inside Track Hamburg 2013Copyright © 2013 evivax IT ConsultingGmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.de
  2. 2. Agenda Unit Testing & ABAP Unit Test Driven Development (TDD) Live CodingCopyright © 2013 evivax IT ConsultingGmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.de
  3. 3. Unit TestingUnit Testing is a method by whichindividual units of source code are testedto determine if they are fit to use.Copyright © 2013 evivax IT ConsultingGmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.de
  4. 4. xUnit FrameworkProvides an automated solution with noneed to write the same tests many timesand no need to remember what should bethe result of each test.Copyright © 2013 evivax IT ConsultingGmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.de
  5. 5. xUnit FrameworkCopyright © 2013 evivax IT ConsultingGmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.desetup( )  test_method( )  teardown( )assert_*( ) – methods
  6. 6. xUnit FrameworkCopyright © 2013 evivax IT ConsultingGmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.desetup( )  test_method( )  teardown( )test_method( )test_method( )test_method( )test_method( )test_method( )test_method( )
  7. 7. ABAP UnitSAP‘s xUnit implemenationCopyright © 2013 evivax IT ConsultingGmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.de
  8. 8. ABAP Unit Local test classes for global dev. artifacts In Reports, Function Modules and Classes Not acitve on production systemsCopyright © 2013 evivax IT ConsultingGmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.de
  9. 9. ABAP Unit Tools integration: ABAP Workbench Code Inspector Integration ABAP Unit Browser ABAP Test Cockpit (ATC) ABAP in EclipseCopyright © 2013 evivax IT ConsultingGmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.de
  10. 10. Test Driven DevelopmentCopyright © 2013 evivax IT ConsultingGmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.de
  11. 11. Test Driven Development Never After you wrote your code Before you write your codeCopyright © 2013 evivax IT ConsultingGmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.deWhen do you write your Unit Tests?Test Driven Development
  12. 12. Test Driven DevelopmentTest 1stCopyright © 2013 evivax IT ConsultingGmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.de
  13. 13. Test Driven DevelopmentTest Cycle:red  green  refactorCopyright © 2013 evivax IT ConsultingGmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.de
  14. 14. TDD CycleCopyright © 2013 evivax IT ConsultingGmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.deWrite a test that expresses how you’lluse the code and what you need it to do.
  15. 15. TDD CycleCopyright © 2013 evivax IT ConsultingGmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.deWrite enough code to get thetest to pass, but no more.
  16. 16. TDD CycleCopyright © 2013 evivax IT ConsultingGmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.deClean up the code to removeredundancy and improve the design.
  17. 17. TDD CycleCopyright © 2013 evivax IT ConsultingGmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.de
  18. 18. Code Kata: Roman NumeralsCopyright © 2013 evivax IT Consulting GmbHGoebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.deRules:• 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 itemsI 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.CThe numeral 100. C is short for the Latin word Centum, but Centuryis eaysier to remember ;-)D The numeral 500.M The numeral 1000.
  19. 19. So Long, and Thanks for All the FishAny Qs?Copyright © 2013 evivax IT ConsultingGmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.de

×