More Related Content Similar to ABAP Unit and TDD (20) ABAP Unit and TDD1. ABAP Unit and TDD
Hendrik Neumann
SAP Inside Track Hamburg 2013
Copyright © 2013 evivax IT Consulting
GmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.de
2. Agenda
Unit Testing & ABAP Unit
Test Driven Development (TDD)
Live Coding
Copyright © 2013 evivax IT Consulting
GmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.de
3. Unit Testing
Unit Testing is a method by which
individual units of source code are tested
to determine if they are fit to use.
Copyright © 2013 evivax IT Consulting
GmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.de
4. 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.
Copyright © 2013 evivax IT Consulting
GmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.de
5. xUnit Framework
Copyright © 2013 evivax IT Consulting
GmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.de
setup( ) test_method( ) teardown( )
assert_*( ) – methods
6. xUnit Framework
Copyright © 2013 evivax IT Consulting
GmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.de
setup( ) test_method( ) teardown( )
test_method( )
test_method( )
test_method( )
test_method( )
test_method( )
test_method( )
7. ABAP Unit
SAP‘s xUnit implemenation
Copyright © 2013 evivax IT Consulting
GmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.de
8. ABAP Unit
Local test classes for global dev. artifacts
In Reports, Function Modules and Classes
Not acitve on production systems
Copyright © 2013 evivax IT Consulting
GmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.de
9. ABAP Unit
Tools integration:
ABAP Workbench
Code Inspector Integration
ABAP Unit Browser
ABAP Test Cockpit (ATC)
ABAP in Eclipse
Copyright © 2013 evivax IT Consulting
GmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.de
11. Test Driven Development
Never
After you wrote your code
Before you write your code
Copyright © 2013 evivax IT Consulting
GmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.de
When do you write your Unit Tests?
Test Driven Development
12. Test Driven Development
Test 1st
Copyright © 2013 evivax IT Consulting
GmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.de
13. Test Driven Development
Test Cycle:
red green refactor
Copyright © 2013 evivax IT Consulting
GmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.de
14. TDD Cycle
Copyright © 2013 evivax IT Consulting
GmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.de
Write a test that expresses how you’ll
use the code and what you need it to do.
15. TDD Cycle
Copyright © 2013 evivax IT Consulting
GmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.de
Write enough code to get the
test to pass, but no more.
16. TDD Cycle
Copyright © 2013 evivax IT Consulting
GmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.de
Clean up the code to remove
redundancy and improve the design.
17. TDD Cycle
Copyright © 2013 evivax IT Consulting
GmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.de
18. Code Kata: Roman Numerals
Copyright © 2013 evivax IT Consulting GmbH
Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.de
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.
19. So Long, and Thanks for All the Fish
Any Qs?
Copyright © 2013 evivax IT Consulting
GmbH Goebelstraße 21 | 64293 Darmstadt | Fon: 06151 - 506420 | e-mail: mail@evivax.de