First Technology Transfer

Standard and Advanced Technical Training, Consultancy and Mentoring

Course UNT103 C++ Unit Testing

Duration: 3 Days

Intended Audience

The course is aimed at C++ developers (including developers of Computer Game software), quality-assurance engineers, and project managers. Students are expected to have a good understanding of C++ and the STL, as well as some familiarity with testing concepts (e.g. unit, integration, functional, and load testing)


The course provides a thorough introduction to unit testing concepts and strategies. It makes use of several of the more widely used C++ unit testing frameworks (CppUnit, Boost.test, CppUnitLite and CxxTest) It covers the concepts underlying unit testing, the requirements and characteristics of good unit testing frameworks and the way these concepts are realised in some practical frameworks. The hands on exercises will familiarise students with test-driven development as a methodology for implementing highly reliable C++ code.


  • Overview of C++ and Unit Testing
    • Basic concepts
    • Requirements of a good testing framework
    • Overview of CppUnitLite and CppUnit
    • Overview of Boost.test
    • Overview of CxxTest
    • Using Asserts
    • Test Composition
    • Exceptions and exception testing
  • What to test for - Right BICEP
    • Right results
    • Boundary Conditions - CORRECT
      • Conformance
      • Ordering
      • Range
      • Reference
      • Existence
      • Cardinality
      • Time
    • Inverse Relationships - checking for
    • Cross checking
    • Error conditions - forcing of
    • Preformance characteristics - met
  • Structuring tests, automating tests, reporting results
    • Composing Test Cases into Test Suites
    • Combining Test Suites
    • Organizing Tests and Test Suites
    • Executing Tests
    • Showing Test Results
    • Reporting (XML and HTML)
    • Testing with Stubs
    • Mock Objects
  • Test-Driven Development (TDD)
    • Best Practices with C++ Unit testing and TDD
    • Designing C++ code with testing in mind
    • Integration and functional testing using C++ Unit testing frameworks
  • Characteristics of Good Tests
    • Automatic
    • Thorough
    • Repeatable
    • Independent
    • Professional
    • Quality controlling tests
  • Testing and Design
    • Designing for testability
    • Refactoring for Testing
    • Defining and verifying Class Invariants
    • Test Driven Design Strategies
    • Testing for Invalid Parameters
  • Testing and Project Planning and Management
    • Where to place the test code
    • Testing etiquette
    • Frequency of testing
    • Testing when working with legacy code
    • Testing and Code Reviews