What You’ll Need

To code any of the examples in this book, you’ll need a compiler, of course, and a unit testing tool. Some of the examples also require third-party libraries. This section overviews these three elements. You’ll want to refer to Chapter 1, Global Setup for further details around what you’ll need.

A Unit Testing Tool

Out of the dozens of available C++ unit testing tools, I chose Google Mock (which sits atop Google Test) for most of the examples in this book. It currently returns the most hits on a web search, but I primarily chose it because it supports Hamcrest notation (a matcher-based assertion form designed to provide highly expressive tests). The information in Chapter 1, Global Setup will help you come up to speed on Google Mock.

However, this book is neither a comprehensive treatise nor a sales brochure for Google Mock. It is instead a book that teaches the discipline of TDD. You’ll learn enough Google Mock to practice TDD effectively.

You’ll also use another unit testing tool named CppUTest for some of the examples. You’ll find that it’s fairly easy to learn another unit testing tool, which should help ease any concerns you might have if you’re not using Google Mock or CppUTest.

If you are using a different unit testing tool such as CppUnit or Boost.Test, no worries! These other tools work much like Google Mock in concept and are often similar in implementation. You can easily follow along and do the TDD examples using virtually any of the other C++ unit testing tools available. See Appendix 1, Comparing Unit Testing Tools for a discussion of what’s important in choosing a unit testing tool.

Most examples in this book use Google Mock for mocking and stubbing (see Chapter 5, Test Doubles). Of course, Google Mock and Google Test work together, but you might also be able to integrate Google Mock successfully with your unit testing tool of choice.

A Compiler

You’ll need access to a C++ compiler with support for C++11. The book example code was originally built using gcc and works out of the box on Linux and Mac OS. See Chapter 1, Global Setup for information about building the example code on Windows. All examples use the STL, an essential part of modern C++ development for many platforms.

Third-Party Libraries

Some of the examples use freely available third-party libraries. Refer to Chapter 1, Global Setup for the specific list of libraries you’ll need to download.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.21.106.7