Submit Search
Upload
ABAPCodeRetreat 23.7.2016 - Unit Testing
•
2 likes
•
798 views
A
ABAPCodeRetreat
Follow
ABAPCodeRetreat Event on 23.7.2016 by Kaufland
Read less
Read more
Software
Report
Share
Report
Share
1 of 14
Download now
Download to read offline
Recommended
ABAPCodeRetreat 23.7.2016 - Abap in Eclipse
ABAPCodeRetreat 23.7.2016 - Abap in Eclipse
ABAPCodeRetreat
Test Driven Development #sitFRA
Test Driven Development #sitFRA
Christian Drumm
ABAPCodeRetreat - TDD Intro by Damir Majer
ABAPCodeRetreat - TDD Intro by Damir Majer
ABAPCodeRetreat
ABAP Code Retreat Frankfurt 2016: TDD - Test Driven Development
ABAP Code Retreat Frankfurt 2016: TDD - Test Driven Development
Hendrik Neumann
Test AI/ML Applications
Test AI/ML Applications
🍻 Tarun Maini
Qtp testing
Qtp testing
Ramu Palanki
Build Your Custom Performance Testing Framework
Build Your Custom Performance Testing Framework
TechWell
Visual Studio ALM 2013 - Edition Comparison
Visual Studio ALM 2013 - Edition Comparison
Steve Lange
Recommended
ABAPCodeRetreat 23.7.2016 - Abap in Eclipse
ABAPCodeRetreat 23.7.2016 - Abap in Eclipse
ABAPCodeRetreat
Test Driven Development #sitFRA
Test Driven Development #sitFRA
Christian Drumm
ABAPCodeRetreat - TDD Intro by Damir Majer
ABAPCodeRetreat - TDD Intro by Damir Majer
ABAPCodeRetreat
ABAP Code Retreat Frankfurt 2016: TDD - Test Driven Development
ABAP Code Retreat Frankfurt 2016: TDD - Test Driven Development
Hendrik Neumann
Test AI/ML Applications
Test AI/ML Applications
🍻 Tarun Maini
Qtp testing
Qtp testing
Ramu Palanki
Build Your Custom Performance Testing Framework
Build Your Custom Performance Testing Framework
TechWell
Visual Studio ALM 2013 - Edition Comparison
Visual Studio ALM 2013 - Edition Comparison
Steve Lange
Building reliable applications with React, C#, and Azure
Building reliable applications with React, C#, and Azure
Maurice De Beijer [MVP]
Building large and scalable mission critical applications with React
Building large and scalable mission critical applications with React
Maurice De Beijer [MVP]
Tests for Every Branch Using CircleCI and Sauce Labs to Continuously Test CS ...
Tests for Every Branch Using CircleCI and Sauce Labs to Continuously Test CS ...
Sauce Labs
Test Armada Sauce Labs
Test Armada Sauce Labs
Test Armada
Introduction to Gauge
Introduction to Gauge
vodqancr
I am hooked on React
I am hooked on React
Maurice De Beijer [MVP]
Qa workshop
Qa workshop
John Doe
Building a culture of quality at scale
Building a culture of quality at scale
Test Armada
Final Automation Testing
Final Automation Testing
priya_trivedi
Execute Automation Testing in 3 Steps
Execute Automation Testing in 3 Steps
ExecuteAutomation
Testing OSGi-based Applications with DA-Testing
Testing OSGi-based Applications with DA-Testing
Valery Abu-Eid
Feature toggles
Feature toggles
Anand Agrawal
Test & Dynamics CRM - extremeCRM Berlin 2012
Test & Dynamics CRM - extremeCRM Berlin 2012
Wael Hamze
Automation Testing with KATALON Cucumber BDD
Automation Testing with KATALON Cucumber BDD
RapidValue
ATAGTR2017 Keeping pace with Product Evolution: UI Automation Framework Guide...
ATAGTR2017 Keeping pace with Product Evolution: UI Automation Framework Guide...
Agile Testing Alliance
Qa process 2012
Qa process 2012
ashokack
Automation With A Tool Demo
Automation With A Tool Demo
Nivetha Padmanaban
Episode 3 – Classes, Inheritance, Abstract Class, and Interfaces
Episode 3 – Classes, Inheritance, Abstract Class, and Interfaces
Jitendra Zaa
Web tech: lecture 5
Web tech: lecture 5
Ardak Shalkarbayuli
ABAPCodeRetreat 23.7.2016 - TDD
ABAPCodeRetreat 23.7.2016 - TDD
ABAPCodeRetreat
ABAPCodeRetreat Frankfurt 2016 - TDD with ABAP
ABAPCodeRetreat Frankfurt 2016 - TDD with ABAP
ABAPCodeRetreat
ABAPCodeRetreat - ABAP PUSH CHANNELS and SAP FIORI
ABAPCodeRetreat - ABAP PUSH CHANNELS and SAP FIORI
ABAPCodeRetreat
More Related Content
What's hot
Building reliable applications with React, C#, and Azure
Building reliable applications with React, C#, and Azure
Maurice De Beijer [MVP]
Building large and scalable mission critical applications with React
Building large and scalable mission critical applications with React
Maurice De Beijer [MVP]
Tests for Every Branch Using CircleCI and Sauce Labs to Continuously Test CS ...
Tests for Every Branch Using CircleCI and Sauce Labs to Continuously Test CS ...
Sauce Labs
Test Armada Sauce Labs
Test Armada Sauce Labs
Test Armada
Introduction to Gauge
Introduction to Gauge
vodqancr
I am hooked on React
I am hooked on React
Maurice De Beijer [MVP]
Qa workshop
Qa workshop
John Doe
Building a culture of quality at scale
Building a culture of quality at scale
Test Armada
Final Automation Testing
Final Automation Testing
priya_trivedi
Execute Automation Testing in 3 Steps
Execute Automation Testing in 3 Steps
ExecuteAutomation
Testing OSGi-based Applications with DA-Testing
Testing OSGi-based Applications with DA-Testing
Valery Abu-Eid
Feature toggles
Feature toggles
Anand Agrawal
Test & Dynamics CRM - extremeCRM Berlin 2012
Test & Dynamics CRM - extremeCRM Berlin 2012
Wael Hamze
Automation Testing with KATALON Cucumber BDD
Automation Testing with KATALON Cucumber BDD
RapidValue
ATAGTR2017 Keeping pace with Product Evolution: UI Automation Framework Guide...
ATAGTR2017 Keeping pace with Product Evolution: UI Automation Framework Guide...
Agile Testing Alliance
Qa process 2012
Qa process 2012
ashokack
Automation With A Tool Demo
Automation With A Tool Demo
Nivetha Padmanaban
Episode 3 – Classes, Inheritance, Abstract Class, and Interfaces
Episode 3 – Classes, Inheritance, Abstract Class, and Interfaces
Jitendra Zaa
Web tech: lecture 5
Web tech: lecture 5
Ardak Shalkarbayuli
What's hot
(19)
Building reliable applications with React, C#, and Azure
Building reliable applications with React, C#, and Azure
Building large and scalable mission critical applications with React
Building large and scalable mission critical applications with React
Tests for Every Branch Using CircleCI and Sauce Labs to Continuously Test CS ...
Tests for Every Branch Using CircleCI and Sauce Labs to Continuously Test CS ...
Test Armada Sauce Labs
Test Armada Sauce Labs
Introduction to Gauge
Introduction to Gauge
I am hooked on React
I am hooked on React
Qa workshop
Qa workshop
Building a culture of quality at scale
Building a culture of quality at scale
Final Automation Testing
Final Automation Testing
Execute Automation Testing in 3 Steps
Execute Automation Testing in 3 Steps
Testing OSGi-based Applications with DA-Testing
Testing OSGi-based Applications with DA-Testing
Feature toggles
Feature toggles
Test & Dynamics CRM - extremeCRM Berlin 2012
Test & Dynamics CRM - extremeCRM Berlin 2012
Automation Testing with KATALON Cucumber BDD
Automation Testing with KATALON Cucumber BDD
ATAGTR2017 Keeping pace with Product Evolution: UI Automation Framework Guide...
ATAGTR2017 Keeping pace with Product Evolution: UI Automation Framework Guide...
Qa process 2012
Qa process 2012
Automation With A Tool Demo
Automation With A Tool Demo
Episode 3 – Classes, Inheritance, Abstract Class, and Interfaces
Episode 3 – Classes, Inheritance, Abstract Class, and Interfaces
Web tech: lecture 5
Web tech: lecture 5
Viewers also liked
ABAPCodeRetreat 23.7.2016 - TDD
ABAPCodeRetreat 23.7.2016 - TDD
ABAPCodeRetreat
ABAPCodeRetreat Frankfurt 2016 - TDD with ABAP
ABAPCodeRetreat Frankfurt 2016 - TDD with ABAP
ABAPCodeRetreat
ABAPCodeRetreat - ABAP PUSH CHANNELS and SAP FIORI
ABAPCodeRetreat - ABAP PUSH CHANNELS and SAP FIORI
ABAPCodeRetreat
TDD in the ABAP world - sitNL 2013 edition
TDD in the ABAP world - sitNL 2013 edition
Hendrik Neumann
Case Study: Automated Code Reviews In A Grown SAP Application Landscape At EW...
Case Study: Automated Code Reviews In A Grown SAP Application Landscape At EW...
Virtual Forge
SAP Inside Track Lima 09 - Keynote
SAP Inside Track Lima 09 - Keynote
Alvaro Tejada
Happy sap hana friends
Happy sap hana friends
Alvaro Tejada
SAP Inside Track Lima 09 - Ruby y SAP
SAP Inside Track Lima 09 - Ruby y SAP
Alvaro Tejada
SmallWorlds - BoF Las Vegas TechEd 2008
SmallWorlds - BoF Las Vegas TechEd 2008
Alvaro Tejada
ABAP Unit and TDD
ABAP Unit and TDD
Hendrik Neumann
The best debugging tool - your brain
The best debugging tool - your brain
Christian Drumm
1H2007 Results Full
1H2007 Results Full
Magnit IR Team
Viewers also liked
(12)
ABAPCodeRetreat 23.7.2016 - TDD
ABAPCodeRetreat 23.7.2016 - TDD
ABAPCodeRetreat Frankfurt 2016 - TDD with ABAP
ABAPCodeRetreat Frankfurt 2016 - TDD with ABAP
ABAPCodeRetreat - ABAP PUSH CHANNELS and SAP FIORI
ABAPCodeRetreat - ABAP PUSH CHANNELS and SAP FIORI
TDD in the ABAP world - sitNL 2013 edition
TDD in the ABAP world - sitNL 2013 edition
Case Study: Automated Code Reviews In A Grown SAP Application Landscape At EW...
Case Study: Automated Code Reviews In A Grown SAP Application Landscape At EW...
SAP Inside Track Lima 09 - Keynote
SAP Inside Track Lima 09 - Keynote
Happy sap hana friends
Happy sap hana friends
SAP Inside Track Lima 09 - Ruby y SAP
SAP Inside Track Lima 09 - Ruby y SAP
SmallWorlds - BoF Las Vegas TechEd 2008
SmallWorlds - BoF Las Vegas TechEd 2008
ABAP Unit and TDD
ABAP Unit and TDD
The best debugging tool - your brain
The best debugging tool - your brain
1H2007 Results Full
1H2007 Results Full
Similar to ABAPCodeRetreat 23.7.2016 - Unit Testing
Expert sizing & methods of sizing validation
Expert sizing & methods of sizing validation
Jaleel Ahmed Gulammohiddin
CV Gabor Vigh
CV Gabor Vigh
G Vigh
DOES16 London - Darren Hague - SAP’s DevOps Journey: From Building an App to ...
DOES16 London - Darren Hague - SAP’s DevOps Journey: From Building an App to ...
Gene Kim
Perf tuning with-multitenant
Perf tuning with-multitenant
Jacques Kostic
MEASURE project : Measuring Software Engineering, OW2con'18, June 7-8, 2018, ...
MEASURE project : Measuring Software Engineering, OW2con'18, June 7-8, 2018, ...
OW2
Code vigil
Code vigil
Kunal Bhat
Measure project ow2-2018
Measure project ow2-2018
Alessandra Bagnato
10 ошибок в работе с аналитикой / Вера Карпова (devtodev)
10 ошибок в работе с аналитикой / Вера Карпова (devtodev)
DevGAMM Conference
Clad exam preparation_guide_using_lab_view_nxg
Clad exam preparation_guide_using_lab_view_nxg
R.VINOTHKUMAR Enginevinoth
Westrich spock-assets-gum
Westrich spock-assets-gum
Brian Westrich
Behaviour Driven Development with SpecFlow
Behaviour Driven Development with SpecFlow
Pascal Laurin
Automating sap testing with qtp10 & qc10
Automating sap testing with qtp10 & qc10
Patrick Sun
Optimizely NYC Developer Meetup - Experimentation at Blue Apron
Optimizely NYC Developer Meetup - Experimentation at Blue Apron
Optimizely
Meetup TestingUy 2017: Automating the Viewer: a cross-functional team approach
Meetup TestingUy 2017: Automating the Viewer: a cross-functional team approach
Claudia Badell
Meetup TestingUy 2017 - Automating the Viewer: a cross-functional team approach
Meetup TestingUy 2017 - Automating the Viewer: a cross-functional team approach
TestingUy
Fossil Benchmarking Analysis
Fossil Benchmarking Analysis
ScottMadden, Inc.
Six sigma on burning brownie
Six sigma on burning brownie
Yamna Rashid
Quick Test Professional (QTP/UFT)
Quick Test Professional (QTP/UFT)
Rajathi-QA
how to implement agile | 12 principles of agile
how to implement agile | 12 principles of agile
AnjaliNair289117
CV_AUTOMATION_TEST_ENGINEER
CV_AUTOMATION_TEST_ENGINEER
PERLA RAVI THEJA
Similar to ABAPCodeRetreat 23.7.2016 - Unit Testing
(20)
Expert sizing & methods of sizing validation
Expert sizing & methods of sizing validation
CV Gabor Vigh
CV Gabor Vigh
DOES16 London - Darren Hague - SAP’s DevOps Journey: From Building an App to ...
DOES16 London - Darren Hague - SAP’s DevOps Journey: From Building an App to ...
Perf tuning with-multitenant
Perf tuning with-multitenant
MEASURE project : Measuring Software Engineering, OW2con'18, June 7-8, 2018, ...
MEASURE project : Measuring Software Engineering, OW2con'18, June 7-8, 2018, ...
Code vigil
Code vigil
Measure project ow2-2018
Measure project ow2-2018
10 ошибок в работе с аналитикой / Вера Карпова (devtodev)
10 ошибок в работе с аналитикой / Вера Карпова (devtodev)
Clad exam preparation_guide_using_lab_view_nxg
Clad exam preparation_guide_using_lab_view_nxg
Westrich spock-assets-gum
Westrich spock-assets-gum
Behaviour Driven Development with SpecFlow
Behaviour Driven Development with SpecFlow
Automating sap testing with qtp10 & qc10
Automating sap testing with qtp10 & qc10
Optimizely NYC Developer Meetup - Experimentation at Blue Apron
Optimizely NYC Developer Meetup - Experimentation at Blue Apron
Meetup TestingUy 2017: Automating the Viewer: a cross-functional team approach
Meetup TestingUy 2017: Automating the Viewer: a cross-functional team approach
Meetup TestingUy 2017 - Automating the Viewer: a cross-functional team approach
Meetup TestingUy 2017 - Automating the Viewer: a cross-functional team approach
Fossil Benchmarking Analysis
Fossil Benchmarking Analysis
Six sigma on burning brownie
Six sigma on burning brownie
Quick Test Professional (QTP/UFT)
Quick Test Professional (QTP/UFT)
how to implement agile | 12 principles of agile
how to implement agile | 12 principles of agile
CV_AUTOMATION_TEST_ENGINEER
CV_AUTOMATION_TEST_ENGINEER
Recently uploaded
MYjobs Presentation Django-based project
MYjobs Presentation Django-based project
AnoyGreter
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
Andreas Granig
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
andrehoraa
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Stefano Stabellini
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
bntitsolutionsrishis
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Matt Ray
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
qr0udbr0
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Christina Lin
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
stazi3110
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
VICTOR MAESTRE RAMIREZ
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
Technogeeks
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Ahmed Mohamed
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
FerryKemperman
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
Velvetech LLC
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
smiwainfosol
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
Ortus Solutions, Corp
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
Hr365.us smith
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
kzayra69
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
Diego Iván Oliveros Acosta
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
Christina Lin
Recently uploaded
(20)
MYjobs Presentation Django-based project
MYjobs Presentation Django-based project
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ABAPCodeRetreat 23.7.2016 - Unit Testing
1.
© Kaufland 2016
| ABAP CODERETREAT WEINSBERG Unit Testing KIS, Weinsberg, 23.07.2016 ABAP CodeRetreat Weinsberg121.07.2016
2.
© Kaufland 2016
| WHO WE ARE KAUFLAND We are more than just a successful international trading company: We are a company where many colleagues become a team, jobs are safe workplaces and real satisfaction Diversity and stability We offer a wide range of jobs with many different entry-levels and career opportunities. Our company is continuously growing, that makes us self-confident Openness and friendly cooperation We support a cooperation based on friendliness and mutual trust ABAP CodeRetreat Weinsberg221.07.2016
3.
© Kaufland 2016
| WHERE WE ARE KAUFLAND Expansive growth, economic size • We are successfully expanding in Germany, Poland, Czech Republic, Slovakia, Croatia, Romania and Bulgaria • Over 150,500 employees form our strong Kaufland team in Europe International cooperation and prospects • We offer an international work environment • We provide a wide variety of tasks in collaboration with our international colleagues • According to the area of deployment you will have the opportunity to collect experience abroad, in one of our European locations ABAP CodeRetreat Weinsberg321.07.2016
4.
© Kaufland 2016
| ABAP CodeRetreat Weinsberg4 KAUFLAND INFORMATION SYSTEMS We are the IT service provider for Kaufland. Ensuring high business performance and carrying data streams on the right track is our daily responsibility Keep IT simple and safe Our objectives are to comprehensively advice our business departments in designing their business processes and to implement software solutions OUR IT IN FIGURES 21.07.2016 220 SAP Systems 40 SAP Developers 25k Z Reports
5.
© Kaufland 2016
| UNIT TESTING ABAP CodeRetreat Weinsberg521.07.2016 Unit Testing Integration Testing System Testing Acceptance Testing
6.
© Kaufland 2016
| ABAP CodeRetreat Weinsberg6 • Set up an initial state • Confront the method under test with test values • Compare actual value with expected test value • Implemented in form of test methods • Test methods are hosted in a test class • Test classes are local classes to the program object under test • Use global test classes only to host reusable logic for tests • Comparisons are done with class CL_ABAP_UNIT_ASSERT UNIT TESTS ABAP UNIT TESTS CREATING ABAP UNIT TESTS UNIT TESTING 21.07.2016
7.
© Kaufland 2016
| • Test classes are local classes defined with the FOR TESTING addition • Test methods are (private) parameterless instance methods, also declared with the FOR TESTING addition • Use Fixtures to ensure particular starting conditions • [class] setup and [class] teardown TEST CLASSES AND TEST METHODS ABAP CodeRetreat Weinsberg7 UNIT TESTING 21.07.2016 setup( ). teardown( ). my_first_test_method( ).
8.
© Kaufland 2016
| EXAMPLE ABAP CodeRetreat Weinsberg8 UNIT TESTING 21.07.2016
9.
© Kaufland 2016
| • Testing starts already during the design of your application • The following slides show some pitfalls you should keep in mind • All coding samples are more or less pseudo-code in ABAP style PREPARATION ABAP CodeRetreat Weinsberg9 UNIT TESTING 21.07.2016
10.
© Kaufland 2016
| ABAP CodeRetreat Weinsberg10 PITFALL #1 CLASS car. PRIVATE SECTION. DATA g_fuel TYPE i. PUBLIC SECTION. set_fuel IMPORTING i_fuel TYPE i. has_fuel RETURNING r_has_fuel TYPE xfeld. ENDCLASS. CLASS testcar FOR TESTING. PRIVATE SECTION. DATA g_testobject TYPE REF TO car. METHOD class_setup. g_testobject = NEW #( ). METHOD test_fuel. g_testobject->set_fuel( 30 ). METHOD test_has_fuel. DATA(has_fuel) = g_test_object->has_fuel( ). ENDCLASS. UNIT TESTING 21.07.2016 • Test cases guarantee no order! • When method test_has_fuel() is called we do not know in which state the test- object already is! • Take care to initialize your test-object before each testcase so that you know the current state! (e.g. use setup() instead of class_setup()) Each testmethod has to return the same result each time it's called otherwise we cannot test it.
11.
© Kaufland 2016
| ABAP CodeRetreat Weinsberg11 PITFALL #2 CLASS order. DATA g_order_number TYPE i. METHOD get_positions. " load data SELECT * FROM mseg WHERE mblnr = g_order_number. " prepare data " do something else " return result. ENDCLASS. UNIT TESTING 21.07.2016 • We do not know what is currently in the database! • We do not know which data will be prepared! • We cannot assume what data will be returned! Do not load information from sources that cannot be controlled during testing. Load data before instantiating the order object. This will enable us to write a testmethod for the data preparation. Alternative solution: use a database- handler-class and pass it as a parameter. During testing you can use a mock of the database-handler that returns fix results.
12.
© Kaufland 2016
| ABAP CodeRetreat Weinsberg12 PITFALL #3 CLASS store. METHOD is_opened. CALL FUNCTION 'DATE_COMPUTE_DAY' EXPORTING date = sy-datum IMPORTING day = day. IF day <> 7. r_is_opened = abap_true. ENDIF. ENDCLASS. UNIT TESTING 21.07.2016 • If we expect the store to be closed the testmethod will only succeed on sundays • Testmethods expect a hard-coded result. Not possible in this case! Don't use system (or other) variables that you cannot control. Better give the date as parameter. So your testmethod can call testobject->is_opened( '20160505' ).
13.
© Kaufland 2016
| ABAP CodeRetreat Weinsberg13 UNIT TESTING 21.07.2016 POSSIBLE ARCHITECTURE Database Database provider Business object Data Access Object (DAO) Database layer Business layerAccess layer
14.
© Kaufland 2016
| • Sample Reports in package: SABP_UNIT_SAMPLE • Executing Tests: Ctrl + Shift + F10 • Verification of test expectations: CL_ABAP_UNIT_ASSERT • Test classes and methods are defined / declared with the FOR TESTING addition • Considerations on how to write testable code must be included in the design avoid the pitfalls HOW TO GET STARTED / KEY TAKEAWAYS ABAP CodeRetreat Weinsberg14 UNIT TESTING 21.07.2016
Download now