1. 首页
  2. 编程语言
  3. C++ 
  4. ModernC++ProgrammingwithTest-DrivenDevelopment

ModernC++ProgrammingwithTest-DrivenDevelopment

上传者: 2019-05-22 17:16:03上传 PDF文件 5.43MB 热度 16次
Modern C++ Programming With Test-Driven Development, the only comprehensive treatment on TDD in C++ provides you with everything you need to know about TDD, and the challenges and benefits of implementing it in your C++ systems. Its many detailed code examples take you step-by-step from TDD basics tEarly Praise for Modern C++ Programming with Test-Driven DevelopmentJeff Langr has written another excellent book. This time he brings Test-DrivenDevelopment to the world of C++. Jeffs starting example brings us face to facewith the stark simplicity of good TDD. He explains why we work that way andthen provides key practical details, all the way through test doubles, working withlegacy code, threading, and more. This one is a keeper for anyone working withC++!Ron JeffriesCo-creator of the Extreme Programming methodologyJeff Langr has written the best C++ book in years. Modern C++ Programming withTest-Driven Development is the perfect mixture of theory and practice. The abstractions are explained with clarity and gusto, but the details are right there wheryou need them. It's sure to be an instant classic, in C++ and in tDd bothMichael D. hillXP coach and writerJeff is an expert software craftsman and in this book he shares his considerablewisdom about crafting great software. This book is not about testing, though youwill learn valuable testing techniques. It is about improving your skills, codeproducts, and life through test-driving. Whether you're a novice, expert, or in between, Jeff will show you the how and the why of an expert who test-drives betterproducts with C++James w. GrenningAuthor of Test-Driven Development for embedded Cwww.allitebooks.comModern C++ Programming withTest-Driven DevelopmentCode better, Sleep BetterJeff langThe Pragmatic BookshelfDallas, Texas. Raleigh, North Carolinawww.allitebooks.comPRagmaticMany of the designations used by manufacturers and sellers to distinguish their productsare claimed as trademarks. Where those designations appear in this book, and The PragmaticProgrammers, llC was aware of a trademark claim, the designations have been printed ininitial capital letters or in all capitals. The Pragmatic Starter Kit, The Pragmatic Programmer,Pragmatic Programming, Pragmatic Bookshelf, Prag Prog and the linking g device are trademarks of The Pragmatic Programmers, LlCEvery precaution was taken in the preparation of this book. However, the publisher assumesno responsibility for errors or omissions, or for damages that may result from the use ofinformation (including program listings) contained hereinOur Pragmatic courses, workshops, and other products can help you and your team createbetter software and have more fun. For more information, as well as the latest Pragmatictitlespleasevisitusathttp://pragprog.comThe team that produced this book includes:Michael Swaine (editorPotomac Indexing, LLC (indexer)Kim Wimpsett(copyeditorDavid J Kelly (typesetter)Janet Furlow (producer)Juliet Benda (rights)Ellie Callahan(support)Copyright 2013 The Pragmatic Programmers, LLCAll rights reservedNo part of this publication may be reproduced, stored in a retrieval system,transmitted, in any form, or by any means, electronic, mechanical, photocopyingrecording, or otherwise, without the prior consent of the publisherPrinted in the united states of americaSBN-13:978-1-937785Encoded using the finest acid-free high-entropy binary digitsBook version P1.0--October 2013www.allitebooks.comContentsForewordIntroductionx1111. Global Setup1.1 Setup1.2 The Examples1.3 C++ Compiler1. 4 CMake65 Google Mock61.6 CppUTest81.7 libcurl1. 8 JsonCpp101. 9 rlo101.10 Boost1.11 Building Examples and Running Tests121.12 Teardown13Test-Driven Development: A First Example152.1 Setup152.2 The Soundex class152.3 Getting Started162.4 Fixing Unclean Code232.5 Incrementalism252.6Fixtures and Setup282.7 Thinking and TDD302.8 Test-Driving VS Testing332.9 What If?362.10 One Thing at a Time372.11 Limiting Length392. 12 Dropping Vowels40www.allitebooks.comContents·vi2. 13 Doing What It Takes to Clarify Tests412.14 Testing outside the Box432.15 Back on track452.16 Refactoring to Single-Responsibility Functions462.17 Finishing Up482.18 What Tests Are We Missing?482.19 Our solution492.20 The Soundex class502.21 Teardown543. Test-Driven Development Foundations553.1 Setup553.2 Unit test and tdd fundamentals3.3 The TDD Cycle: Red-Green-Refactor573.4 The Three rules of tDD593.5 Getting Green on Red603.6 Mind-Sets for Successful Adoption of TDD693.7 Mechanics for Success733.8 Teardown774. Test construction794.1Setup794.2 Organization794. 3 Fast Tests. Slow Tests. Filters. and suites864.4 Assertions894.5 Inspecting Privates964.6 Testing vs. Test-Driving: Parameterized Tests and otheroys1004.7 Teardown1035. Test doubles105Setup1055.2 Dependency challenges1055.3 Test Doubles1065.4 A Hand-Crafted Test double1075.5 Improving Test Abstraction When Using Test Doubles1125.6 Using Mock Tools1145.7 Getting Test Doubles in Place1235.8 Design Will Change1305.9 Strategies for Using Test Doubles132www.allitebooks.comContents·vi5.10 Miscellaneous Test Double Topics1365.11 Teardown1386. Incremental Design1416.1 Setup1416.2 Simple design1416.3 Where Is the Up-Front Design?1666.4 Refactoring Inhibitors1696.5 Teardown1717. Quality Tests1737.1 Setup1737.2 Tests Come FIrst1737.3 One Assert per Testl787. 4 Test abstraction1817.5 Teardown1948. Legacy Challenges1958.1 Setup1958.2 Legacy Code1958. 3 Themes1968.4 The Legacy Application1988.5 A Test-Driven Mentality2018.6 Safe Refactoring to Support Testing2028.7 Adding tests to Characterize Existing Behavior2058.8 Sidetracked by the reality of legacy code2068.9 Creating a Test Double for rlog2078.10 Test-Driving changes2118.11 A New Story2138. 12 A Brief Exploration in Seeking Faster Tests2148.13 Mondo extracto2158. 14 Spying to Sense Using a Member variable2188.15 Spying to Sense Using a Mock2198.16 Alternate Injection Techniques2248.17 Large-Scale Change with the Mikado Method2248.18 An Overview of the mikado method2258.19 Moving a Method via Mikado2268.20 More Thoughts on the Mikado Method2368.21 Is It Worth it?2378.22 Teardown238www.allitebooks.com9. TDD and Threading2399.1Setup2399.2 Core Concepts for Test-Driving Threads2399. 3 The Geoserver2409.4 Performance Requirements2469.5 Designing an asynchronous solution2499.6 Still Simply Test-Driving2529.7 Ready for a thready2549.8 Exposing Concurrency Issues2569.9 Creating Client Threads in the Test2599.10 Creating Multiple Threads in the ThreadPool2619. 11 Back to the geoserver2639.12 Teardown26710. Additional TDD Concepts and Discussions26910. 1 Setup26910.2 TDD and Performance26910.3 Unit Tests, Integration Tests, and Acceptance tests27810.4 The Transformation Priority Premise28110.5 Writing assertions First29410.6 Teardown298ll. Growing and sustaining TDD2991.1 Setup29911.2 Explaining TDd to Nontechies30011. 3 The Bad Test Death Spiral, aka the sCummy cycle3041. 4 Pair Programming30611.5 Katas and Dojos31011.6 Using the Code Coverage Metric Effectively31311.7 Continuous Integration3141. 8 Deriving Team Standards for TDD31511. 9 Keeping Up with the Community31611.10 Teardown317Al. Comparing unit Testing tools319Al I Setup319Al.2 TDD Unit Testing Tool Features319Al.3 Notes on Google mock321Al.4 Notes on CppUTest321Al.5 Other Unit Testing frameworks321Al. 6 Teardown322www.allitebooks.comContents·ia2. Code kata: roman numeral converter323A2. I Setup323a2.2 Lets go!323A2.3 Practice Makes perfect331A2.4 Teardown331A3. Bibliography333Index335www.allitebooks.com
用户评论