33,59 €
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, you will use test-driven development (TDD) to gain practical skills 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 with unique features not found in other libraries.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 575
Veröffentlichungsjahr: 2022
A simple guide to writing bug-free Agile code
Abdul Wahid Tanner
BIRMINGHAM—MUMBAI
Copyright © 2022 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author(s), nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Group Product Manager: Gebin George
Publishing Product Manager: Kunal Sawant
Senior Editor: Nithya Sadanandan
Technical Editor: Jubit Pincy
Copy Editor: Safis Editing
Project Coordinator: Deeksha Thakkar
Proofreader: Safis Editing
Indexer: Rekha Nair
Production Designer: Shyam Sundar Korumilli
Developer Relations Marketing Executive: Sonakshi Bubbar
First published: October 2022
Production reference: 1211022
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-80324-200-2
www.packt.com
Focus on constant improvement
– Abdul Wahid Tanner
I'm Abdul Wahid Tanner and have been programming C++ since 1992 and teaching others how to code for almost as long. I first became interested in TDD around 2005 and decided to implement a board game that I liked playing using strict TDD. At the time, I was using C# and a test framework that was able to find and run the tests. It wasn't until about 2014 that I decided to see whether I could use C++ and TDD together. There were many choices for tools that helped run C++ tests, but they were big and full of features. I wanted something small and simple, so I wrote a unit test library in about 650 lines of code. The code in this book is a complete and better rewrite of that early code. I hope you find the code in this book useful and decide to use it in your projects. However, even if you decide to use one of the commercial tools, you should still benefit from the understanding that this book provides about how the tools work and how to follow the TDD process.
Serban Stoenescu is a software developer specializing in C++. He is currently working for Everseen on some projects that require OpenCV and some machine learning. In the past he has worked for SkAD Labs on a CAD project with OpenCASCADE, Atigeo on Big Data projects in Java, and Alcatel-Lucent (now part of Nokia). At Alcatel-Lucent, he was also a trainer, teaching Rational ROSE. He is the co-author of “Towards the Impact of Design Flaws on the Resources Used by an Application”, a paper at ARMS-CC 2014. Currently, he is also a Udemy instructor, his most popular course being “C++ Unit Testing: Google Test and Google Mock”. His other courses are “CMake from Zero to Hero” and “C++ Machine Learning Algorithms Inspired by Nature”.
This book is divided into three parts. In this first part, you’ll learn why Test-Driven Development is important and how to use it to help you design and write software. We’ll be starting with an empty project and using Test-Driven Development practices to design and build a unit test library. You’ll learn everything you need by following along as we explore ideas and build a working project one step at a time.
The following chapter will be covered in this part:
Chapter 1, Desired Test DeclarationChapter 2, Test ResultsChapter 3, The TDD processChapter 4, Adding Tests to a ProjectChapter 5, Adding More Confirm TypesChapter 6, Explore Improvements EarlyChapter 7, Test Setup and TeardownChapter 8, What Makes a Good Test?