Book description
Learn how to write a simple testing framework and extend it to drive the design of your logging library
Key Features
- Learn how to solve various challenges when testing in C++ with the help of effective solutions
- Develop a logging library with enhancements
- Drive better code designs with effective tests
Book Description
Modern, standard C++ is all that is needed to create a small and practical testing framework that will improve the design of any project. This allows you to think about how the code will be used, which is the first step in designing intuitive interfaces. TDD is a modern balanced software development approach that helps to create maintainable applications, provide modularity in design, and write minimal code that drastically reduces defects. With the help of this book, you'll be able to continue adding value when designs need to change by ensuring that the changes don't break existing tests.
In this book, developers working with test-driven development (TDD) will be able to put their knowledge to work by writing a simple testing framework and then using it to drive the design of a logging library. The book will help you enhance your software development skills with test cases. You'll understand how to design and implement test cases. The chapters will also show you how to utilize the TDD approach to be more productive in software development than attempting to code in large unstructured steps.
By the end of this book, you'll have gained knowledge of TDD and testing and also built a working logging library.
What you will learn
- Understand how to develop software using TDD
- Keep the code for the system as error-free as possible
- Refactor and redesign code confidently
- Communicate the requirements and behaviors of the code with your team
- Understand the differences between unit tests and integration tests
- Use TDD to create a minimal viable testing framework
Who this book is for
This book is for C++ developers already familiar with and using C++ for daily tasks who want to improve their skillset. You don't need to be an expert but you should already have some knowledge of modern C++ and how to use templates to get the most out of this book.
Table of contents
- Test-Driven Development with C++
- Contributors
- About the author
- About the reviewer
- Preface
- Part 1: Testing MVP
- Chapter 1: Desired Test Declaration
- Chapter 2: Test Results
- Chapter 3: The TDD Process
- Chapter 4: Adding Tests to a Project
- Chapter 5: Adding More Confirm Types
- Chapter 6: Explore Improvements Early
- Chapter 7: Test Setup and Teardown
- Chapter 8: What Makes a Good Test?
- Part 2: Using TDD to Create a Logging Library
- Chapter 9: Using Tests
-
Chapter 10: The TDD Process in Depth
- Technical requirements
- Finding gaps in the testing
- Adding log levels
- Adding default tag values
- Exploring filtering options
- Adding new tag types
- Refactoring the tag design with TDD
- Designing tests to filter log messages
- Controlling what gets logged
- Enhancing filtering for relative matches
- When is testing too much?
- How intrusive should tests be?
- Where do integration or system tests go in TDD?
- What about other types of tests?
- Summary
- Chapter 11: Managing Dependencies
- Part 3: Extending the TDD Library to Support the Growing Needs of the Logging Library
- Chapter 12: Creating Better Test Confirmations
- Chapter 13: How to Test Floating-Point and Custom Values
- Chapter 14: How to Test Services
- Chapter 15: How to Test With Multiple Threads
- Index
- Other Books You May Enjoy
Product information
- Title: Test-Driven Development with C++
- Author(s):
- Release date: November 2022
- Publisher(s): Packt Publishing
- ISBN: 9781803242002
You might also like
book
Template Metaprogramming with C++
Understand how to use modern C++ templates for writing maintainable, robust, and fast software Key Features …
book
Functional Programming in C++
Functional Programming in C++ teaches developers the practical side of functional programming and the tools that …
book
Cross-Platform Development with Qt 6 and Modern C++
Enhance your cross-platform programming abilities with the powerful features and capabilities of Qt 6 Key Features …
book
Modern C++ Programming with Test-Driven Development
If you program in C++ you've been neglected. Test-driven development (TDD) is a modern software development …