Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.
Deutschsprachige SAP® Anwendergruppe
Test Driven Development in ABAP
Christian Drumm, FACTUR Billing Solutions GmbH
Thomas...
Agile Software Development
 Agile principles
 Agile processes
 Agile methods
Re-
factoring
Scrum
Continuous
Integration...
Test Driven Development – Introduction
 Approach
1. Implement test
2. Implement application logic
3. Refactor
 Advantage...
Test Driven Development – Tools
 ABAP Unit
> xUnit implementation in ABAO
test_method1( )
test_method2( )
> setup( )  te...
Test Driven Development – Examples
5
Data access and business logic
mixed within one method.
Test Driven Development – Examples
6
Simple unit test.
Test Driven Development – Examples
7
Data access using a data access
class and preparation for
dependency injection.
Mock ...
Test Driven Development in practice
 Independent developments vs. extensions of the SAP standard
> Usage in independent d...
The biggest issue when writing Unit Tests
9
Unit Test
Application
Code
Dependent
Components
Configuration
User Interface
C...
The biggest issue when writing Unit Tests
10
Unit Test
Application
Code
Dependent
Components
Configuration
User Interface
...
Example: Currency Conversion
11
Conversion-
rate
Application
Currency
Converter
Unit Test Mock
Code Example (Application Code)
12
„Dependency Injection“ to control
dependencies between
components
Decoupling via interf...
Code Example (Test Code)
13
Code Example (Test Code with Mock)
14
SAP Test Double
Framework
What about Legacy
Code ?
15
Application Code Test Code
Code Example (Legacy Code)
16
Application Code Test Code
Code Replacement via Test-Seams
17
References
 Getting Started with ABAP Testing and Troubleshooting - http://scn.sap.com/docs/DOC-24152
 Introdcution to t...
Die vorliegende Präsentation ist urheberrechtlich geschützt (Copyright). Alle Rechte liegen, soweit nicht ausdrücklich and...
Nächste SlideShare
Wird geladen in …5
×

Test Driven Development #sitFRA

1.736 Aufrufe

Veröffentlicht am

Test Driven Development in ABAP

Veröffentlicht in: Software
  • Als Erste(r) kommentieren

Test Driven Development #sitFRA

  1. 1. Deutschsprachige SAP® Anwendergruppe Test Driven Development in ABAP Christian Drumm, FACTUR Billing Solutions GmbH Thomas Fiedler, SAP SE
  2. 2. Agile Software Development  Agile principles  Agile processes  Agile methods Re- factoring Scrum Continuous Integration XP… Kanban Pair pro- gramming Unit Tests
  3. 3. Test Driven Development – Introduction  Approach 1. Implement test 2. Implement application logic 3. Refactor  Advantages > Software architecture > Quality > Maintainability > Tests as documentation 3 Red GreenRefactor
  4. 4. Test Driven Development – Tools  ABAP Unit > xUnit implementation in ABAO test_method1( ) test_method2( ) > setup( )  test_method3( )  teardown( ) test_method4( ) test_methodN( )  Integrated into SE80 and ABAP in Eclipse > Execute tests on class and package level > Test coverage analysis  Integrated into ABAP Test Cockpit 4
  5. 5. Test Driven Development – Examples 5 Data access and business logic mixed within one method.
  6. 6. Test Driven Development – Examples 6 Simple unit test.
  7. 7. Test Driven Development – Examples 7 Data access using a data access class and preparation for dependency injection. Mock implementation of data access class.
  8. 8. Test Driven Development in practice  Independent developments vs. extensions of the SAP standard > Usage in independent developments is straightforward > Usage to extend SAP standard sometimes very difficult (e.g. BAdIS)  Legacy code vs. new code > TDD only possible for new code > TDD for legacy code may require fundamental changes to software architecture  Possibility of TDD depends on the used frameworks / APIs > BOL layer in CRM is very suitable for TDD > TDD in the context of e.g. the business partner BAPIs is virtually impossible 8
  9. 9. The biggest issue when writing Unit Tests 9 Unit Test Application Code Dependent Components Configuration User Interface Customizing Database access Remote Call Unknown Functions
  10. 10. The biggest issue when writing Unit Tests 10 Unit Test Application Code Dependent Components Configuration User Interface Customizing Database access Remote Call Unknown Functions Mocking
  11. 11. Example: Currency Conversion 11 Conversion- rate Application Currency Converter Unit Test Mock
  12. 12. Code Example (Application Code) 12 „Dependency Injection“ to control dependencies between components Decoupling via interfaces
  13. 13. Code Example (Test Code) 13
  14. 14. Code Example (Test Code with Mock) 14 SAP Test Double Framework
  15. 15. What about Legacy Code ? 15
  16. 16. Application Code Test Code Code Example (Legacy Code) 16
  17. 17. Application Code Test Code Code Replacement via Test-Seams 17
  18. 18. References  Getting Started with ABAP Testing and Troubleshooting - http://scn.sap.com/docs/DOC-24152  Introdcution to the SAP Test Double Framework - http://scn.sap.com/docs/DOC-61154  ABAP in Eclipse SCN community - http://scn.sap.com/community/abap/eclipse 18
  19. 19. Die vorliegende Präsentation ist urheberrechtlich geschützt (Copyright). Alle Rechte liegen, soweit nicht ausdrücklich anders gekennzeichnet, bei der Deutschsprachigen SAP-Anwendergruppe e. V.. Jedwede unerlaubte Verwendung ist nicht gestattet. Dies gilt insbesondere für die Vervielfältigung, Verbreitung, Übersetzung oder die Verwendung in elektronischen Systemen / digitalen Medien.  Deutschsprachige SAP® Anwendergruppe e.V. Altrottstraße 34a D-69190 Walldorf  Tel.: +49-(0)6227-358 09-58 Fax: +49-(0)6227-358 09-59 E-Mail: info@dsag.de Web: www.dsag.de  DSAG in Österreich Tel.: +43-(0)1-310 13 76 E-Mail: info@dsag.at Web: www.dsag.at  DSAG in der Schweiz Tel.: +41-(0)31-311 10 03 E-Mail: info@dsag-ev.ch Web: www.dsag-ev.ch © DSAG e.V. Kontakt DSAG

×