My Account Log in

1 option

Test-driven development with C++ : a simple guide to writing bug-free agile code / Abdul Wahid Tanner.

O'Reilly Online Learning: Academic/Public Library Edition Available online

View online
Format:
Book
Author/Creator:
Tanner, Abdul Wahid, author.
Language:
English
Subjects (All):
Computer software--Development.
Computer software.
Physical Description:
1 online resource (430 pages)
Edition:
First edition.
Place of Publication:
Birmingham, England : Packt Publishing Ltd., [2022]
Biography/History:
Tanner Abdul Wahid: Abdul Wahid Tanner is the founder and an instructor at Take Up Code which teaches programmers the joys of coding through live classes, podcasts, books and more. He has authored two self-published titles, "How To Code C++ From A Simple Idea To A Game You'll Understand! " and "The C++ Game Starter Template System". He was previously working as a software engineer at Bloomberg LP, and a Principal Software Engineer at Citrix. With over four decades of experience in the tech world, he has worked with established companies such as Dell and Microsoft in the past, and has been a speaker at CppCon. He currently resides in Texas, USA.
Summary:
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.
Contents:
Cover
Title Page
Copyright and Credits
Contributors
About the reviewer
Table of Contents
Preface
Part 1: Testing MVP
Chapter 1: Desired Test Declaration
Technical requirements
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?
Summary
Chapter 2: Test Results
Reporting a single test result
Enhancing the test declaration to support multiple tests
Summarizing the results
Redirecting the output results
Chapter 3: The TDD Process
Build failures come first
Do only what is needed to pass
Enhancing a test and getting another pass
Chapter 4: Adding Tests to a Project
How to detect whether a test passes or fails
Enhancing the testing library to support assertions
Should error cases be tested, too?
Chapter 5: Adding More Confirm Types
Fixing the bool confirms
Confirming equality
Decoupling test failures from line numbers
Adding more confirm types
Confirming string literals
Confirming floating point values
How to write confirms
Chapter 6: Explore Improvements Early
Getting line numbers without macros
Exploring lambdas for tests
Chapter 7: Test Setup and Teardown
Supporting test setup and teardown
Enhancing test setup and teardown for multiple tests
Handling errors in setup and teardown
Chapter 8: What Makes a Good Test?
Making tests easy to understand
Keeping tests focused on specific scenarios
Use random behavior only in this way
Only test your project.
Test what should happen instead of how
Part 2: Using TDD to Create a Logging Library
Chapter 9: Using Tests
Why build a logging library?
How will TDD help build a logging library?
What would the ideal logging library look like?
Starting a project using TDD
Logging and confirming the first message
Adding timestamps
Constructing log messages with streams
Chapter 10: The TDD Process in Depth
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?
Chapter 11: Managing Dependencies
Designing with dependencies
Adding multiple logging outputs
Part 3: Extending the TDD Library to Support the Growing Needs of the Logging Library
Chapter 12: Creating Better Test Confirmations
The problem with the current confirmations
Simplifying string confirmations
Enhancing the test library to support Hamcrest matchers
Adding more Hamcrest types
Chapter 13: How to Test Floating-Point and Custom Values
More precise floating-point comparisons
Adding floating-point Hamcrest matchers
Writing custom Hamcrest matchers
Chapter 14: How to Test Services
Service testing challenges
What can be tested in a service?
Introducing the SimpleService project
Summary.
Chapter 15: How to Test With Multiple Threads
Using multiple threads in tests
Making the logging library thread-safe
The need to justify multiple threads
Changing the service return type
Making multiple service calls
How to test multiple threads without sleep
Fixing one last problem detected with logging
Index
Other Books You May Enjoy.
Notes:
Description based on publisher supplied metadata and other sources.
Description based on print version record.
ISBN:
9781803238067
1803238062
OCLC:
1350079212

The Penn Libraries is committed to describing library materials using current, accurate, and responsible language. If you discover outdated or inaccurate language, please fill out this feedback form to report it and suggest alternative language.

Find

Home Release notes

My Account

Shelf Request an item Bookmarks Fines and fees Settings

Guides

Using the Find catalog Using Articles+ Using your account