Unit Testing: The fundament of Test-Driven Development

Day(s): 1
Dates/City:

Contact us

Price:

On request

Overview

The principal goal of unit testing is to take the tiniest piece of testable software in an application, isolate it from the rest of the code, and determine whether it behaves as expected – primarily: The outer observable behavior. Each unit is tested separately before integrated into higher order modules. Unit testing has evidenced its worth in that a large percentage of defects are identified during its use.

The Test Driven Development process implies in in purest form: 1st, define what/how the feature shall be tested; 2nd, implement code forming the feature and make its test(s) to pass; finally, 3rd, refactor the code in order to fit into an appropriate standard - i.e., an architecture. The driving force to behind TDD is the Unit Test.

Goal/Benefits

 This twofold one day seminar – partitioned into an introductory part, and an advanced part - provides the participant with a number of concepts around TDD in terms of unit testing:

  • Test-Driven Development – TDD 
  • Decoupling 
  • Software Architecture with Testability in Mind
  • Embedded TDD Strategies
  • DRY: Don’t Repeat Yourself!
  • Legacy Code Testing
  • Mocking
  • Refactoring

Audience/Participants

This training is aimed for embedded system C programmers dealing with development of new features, as well as maintenance of existing legacy systems.

Contact

Lena Bernhardsson

phone: +46 (0) 40 59 22 09
phone: +47 (0) 92 44 22 09 (no)
lena.bernhardsson@nohau.se

Content

Outline

Introductory Part: A1

Test-Driven Development – TDD Why?

  • What’s TDD
  • Benefits of TDD in an Embedded System Context

Introductory Part: A2

Decoupling – The Art of Decreasing Links and Dependencies

  • Why?
    • Facilitates Testing
    • Facilitates Extension/Replacement
      • Variants
    • Facilitates Porting
  • Architecture with Decoupling in Mind
    • Legacy – How to Tackle a Monolith
    • Blank Paper – Just go for it!
    • Hybrid – Legacy and New Features in Harmony

Introductory Part: A3

Designing Code with Testability in Mind

  • The Fewer Execution Paths, the Better!
  • Controlling Behavior – or avoiding if-else
    • Function Pointers
    • Tables

Outline Advanced Part: B1

Embedded TDD Strategies

  • Dual Targeting:
      • The Target 
      • The Development Environment, i.e., the Test Environment
    • Risks
  • Mocking:
    • Checking what’s Issued from the Unit Under Test, UUT
    • Controlling what’s Provided to the UUT
      • Normal and Boundary Data
    • At run-time
    • At link-time
  • Legacy Code:
    • Refactoring - Breaking Dependencies
    • Legacy Code Change Procedure
  • Patterns and Antipatterns

Outline Advanced Part: B2

Workshop - Discussion on a Piece Of Existing (legacy) Code

  • Refactoring – in order to break up dependencies
  • Unit Tests – application of unit tests on the refactored code
 
Share |