C++ Test-Driven Development

All developers want to build good quality software but not all developers test their software as they go along. Why not? A common explanation is "I don't have time to write tests!" The more pressure they feel, the fewer tests they write. This leads to less accurate and stable code, less productivity, less confidence and, ultimately, more pressure. It's a vicious cycle.This course is designed to help you break out of the cycle by embracing unit-testing and, in particular, test-driven development. We will introduce the techniques and the tools necessary to prove your code as you go along.The course makes use of GoogleTest during the labs and demos. If you’d like to use a different test framework instead, that can be arranged.

What you will learn:

  • Writing tests using GoogleTest.
  • Using assertions and matchers.
  • Adopting a test-driven approach to development.
  • Using stubs and mock objects.

Audience:

This training course is aimed at C++ developers

Prerequisites:

At least 3 months C++ programming experience

Course outline:

Getting Started with Unit Testing

  • Setting the Scene
  • Getting Started with GoogleTest
  • Implementing Tests

Using a GCC Toolchain

  • Planning and Organizing Tests

Industrial-Strength Unit Tesing

  • Telling GoogleTest How to Display Objects
  • Testing for Exceptions
  • Using gMock Matchers

Parameterized Tests 

  • Value-Parameterized Tests
  • Value-Parameterized Tests, Going Further
  • Typed Tests
  • Type-Parameterized Tests

Test-Driven Development

  • Effective Test-Driven Development
  • Refactoring Techniques
  • Types of Test

Test Doubles

  • Making Code Testable
  • Overview of Test Doubles
  • Using Stubs
  • Getting Started with Mocking
  • How to do Mocking using gMock

 

Andy Olsen - author of the course

Andy is a freelance consultant and instructor based in the UK, working mostly in the City of London and Oxford. Andy has been working with .NET since the Beta 1 days and has extensive experience in many facets of .NET development including WCF, WPF, WF, ASP.NET MVC Web development, and mobile applications. Andy has designed and written many Microsoft Official Curriculum courses in the last decade, and has been engaged as author and technical reviewer with Apress on some of their biggest selling books.

Other relevant courses

19. May
3 days
Classroom Virtual
2 days
Classroom
21. May
3 days
Classroom
10. March
5 days
Classroom Virtual