17
@majcon Test-Driven Development ABAPCodeRetreat de Meern 2017

ABAPCodeRetreat - TDD Intro by Damir Majer

Embed Size (px)

Citation preview

Page 1: ABAPCodeRetreat - TDD Intro by Damir Majer

@majcon

Test-Driven Development

ABAPCodeRetreat de Meern 2017

Page 2: ABAPCodeRetreat - TDD Intro by Damir Majer

2

Damir Majer Developer, Dev Coach and Trainer @majcon

Unit-Tests mit ABAP® Unit dpunkt.verlag

Besseres ABAP Schnell, sicher, robust SAP Press

CodeKata ABAP Collaboration Project www.codekata.io

Page 3: ABAPCodeRetreat - TDD Intro by Damir Majer

Software development is complex

Page 4: ABAPCodeRetreat - TDD Intro by Damir Majer

Copyright Majer Consulting

hey boss everything is under control…

how is presented how the truth is

Page 5: ABAPCodeRetreat - TDD Intro by Damir Majer

Systematic testing

5

Testing techniquesAd-hoc testingError guessing

Boundary value analysis Path coverage testingIntuitive testing

Semantic testingControl flow testing Business process testing

Branch coverage testing

State transition analysisCondition coverage testing

Cause-effect analysis Dataflow testing

Classification tree method

Compiler testingTesting in pairs

Elementary comparison test

Weak point testing

Area analysis testing

Equivalence class partitioning analysis

Testing with a random value

Syntax testing Statement coverage testing

Page 6: ABAPCodeRetreat - TDD Intro by Damir Majer

How to achieve testing during the implementation phase?

Page 7: ABAPCodeRetreat - TDD Intro by Damir Majer

Unit vs. integration testing

7

Integration testing Unit testing

Page 8: ABAPCodeRetreat - TDD Intro by Damir Majer
Page 9: ABAPCodeRetreat - TDD Intro by Damir Majer

Unit-Testing

“unit testing is a software testing method

by which individual units of source code, sets of one or more computer program modules together with associated control data, usage procedures, and operating procedures,

are tested to determine whether they are fit for use

WIKIPEDIA:

Page 10: ABAPCodeRetreat - TDD Intro by Damir Majer

Test-Driven Development

“is a software development process that relies on the repetition of a very short development cycle: requirements are turned into very specific test cases, then the software is improved to pass the new tests, only. This is opposed to software development that allows software to be added that is not proven to meet requirements.

…TDD encourages simple designs and inspires confidence.

Test-driven development is related to the test-first programming concepts of extreme programming, begun in 1999,

but more recently has created more general interest in its own right.”

WIKIPEDIA:

Page 11: ABAPCodeRetreat - TDD Intro by Damir Majer

11and now?

Page 12: ABAPCodeRetreat - TDD Intro by Damir Majer

Execution of ABAP Unit-Tests SAP GUI or ABAP in Eclipse:

CTRL+SHIFT+F10

ABAP Unit on a Postcard

Page 13: ABAPCodeRetreat - TDD Intro by Damir Majer

plan actualvs.

ABAP Unit Assertion-Methods

Page 14: ABAPCodeRetreat - TDD Intro by Damir Majer

Test Driven Development

• write a test • make it fail • keep it simple • tests are examples • tests becomes

documentation

abapcoderetreat.events ACR

RED GREEN

REFACTOR

• get to green fast • take baby steps • stuck? undo and start

over • write only enough code

to pass the test

• remove duplication (in code and tests)

• rename and clean up • run tests and stay green • change implementation

not behaviour • improve structure in

small steps

you start here!

Page 15: ABAPCodeRetreat - TDD Intro by Damir Majer

What is your experience?

Page 16: ABAPCodeRetreat - TDD Intro by Damir Majer

one more thing…

ABAP Trainings with focus on ABAP Unit and TDD

WDE401WDAGIL

BC401

TDD with ABAP cATDD

Page 17: ABAPCodeRetreat - TDD Intro by Damir Majer

Hands on…