Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Test-Driven Development with C++

You're reading from   Test-Driven Development with C++ A simple guide to writing bug-free Agile code

Arrow left icon
Product type Paperback
Published in Nov 2022
Publisher Packt
ISBN-13 9781803242002
Length 430 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Author (1):
Arrow left icon
Abdul Wahid Tanner Abdul Wahid Tanner
Author Profile Icon Abdul Wahid Tanner
Abdul Wahid Tanner
Arrow right icon
View More author details
Toc

Table of Contents (21) Chapters Close

Preface 1. Part 1: Testing MVP
2. Chapter 1: Desired Test Declaration FREE CHAPTER 3. Chapter 2: Test Results 4. Chapter 3: The TDD Process 5. Chapter 4: Adding Tests to a Project 6. Chapter 5: Adding More Confirm Types 7. Chapter 6: Explore Improvements Early 8. Chapter 7: Test Setup and Teardown 9. Chapter 8: What Makes a Good Test? 10. Part 2: Using TDD to Create a Logging Library
11. Chapter 9: Using Tests 12. Chapter 10: The TDD Process in Depth 13. Chapter 11: Managing Dependencies 14. Part 3: Extending the TDD Library to Support the Growing Needs of the Logging Library
15. Chapter 12: Creating Better Test Confirmations 16. Chapter 13: How to Test Floating-Point and Custom Values 17. Chapter 14: How to Test Services 18. Chapter 15: How to Test With Multiple Threads 19. Index 20. Other Books You May Enjoy

Desired Test Declaration

If we’re going to have a test-driven development (TDD) process, we need tests. This chapter will explain what the tests will do, how we will write them, and how we will use them.

We’ll be starting from the very beginning and slowly building a full library to help manage and run tests, and we’ll be using the test library to help build itself. Initially, there will only be a single test. The following chapters will add more capabilities and grow the test library.

Starting with the end goal in mind, we’ll first think about what it will be like to create and use a test. Writing tests is a big part of TDD, so it makes sense to start thinking about testing even before we have the ability to create and run tests.

TDD is a process that will help you design better code and then make changes to your code without breaking parts that you’ve already verified to be working as expected. In order for this process to work, we need to be able to write tests. This chapter will explore what tests can do for us and how we can write them.

We’ll cover the following main topics in this chapter:

  • What do we want tests to do for us?
  • What should a test look like?
  • What information does a test need?
  • How can we use C++ to write tests?
  • How will the first test be used?
You have been reading a chapter from
Test-Driven Development with C++
Published in: Nov 2022
Publisher: Packt
ISBN-13: 9781803242002
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £16.99/month. Cancel anytime