1. Trang chủ
  2. » Công Nghệ Thông Tin

Test-Driven iOS Development pptx

585 1,1K 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 585
Dung lượng 9,26 MB

Nội dung

www.it-ebooks.info Test Driven www.it-ebooks.info www.it-ebooks.info Test Driven PRACTICAL TDD AND ACCEPTANCE TDD FOR JAVA DEVELOPERS LASSE KOSKELA MANNING Greenwich (74° w. long.) www.it-ebooks.info For online information and ordering of this and other Manning books, please visit www.manning.com. The publisher offers discounts on this book when ordered in quantity. For more information, please contact: Special Sales Department Manning Publications Co. Sound View Court 3B fax: (609) 877-8256 Greenwich, CT 06830 email: orders@manning.com ©2008 by Manning Publications Co. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps. Recognizing the importance of preserving what has been written, it is Manning’s policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end. Manning Publications Co. Copyeditor: Laura Merrill Sound View Court 3B Typesetter: Gordan Salinovic Greenwich, CT 06830 Cover designer: Leslie Haimes ISBN 1-932394-85-0 Printed in the United States of America 12345678910–MAL –13121110090807 www.it-ebooks.info To my colleagues, for bugging me to finish this project. And to my love Lotta, who gave me the energy to do it. www.it-ebooks.info www.it-ebooks.info vii brief contents PART 1 A TDD PRIMER 1 1 ■ The big picture 3 2 ■ Beginning TDD 43 3 ■ Refactoring in small steps 75 4 ■ Concepts and patterns for TDD 99 PART 2APPLYING TDD TO SPECIFIC TECHNOLOGIES 151 5 ■ Test-driving web components 153 6 ■ Test-driving data access 195 7 ■ Test-driving the unpredictable 249 8 ■ Test-driving Swing 279 www.it-ebooks.info viii BRIEF CONTENTS PART 3BUILDING PRODUCTS WITH ACCEPTANCE TDD 321 9 ■ Acceptance TDD explained 323 10 ■ Creating acceptance tests with Fit 364 11 ■ Strategies for implementing acceptance tests 396 12 ■ Adopting TDD 435 appendix A ■ Brief JUnit 4 tutorial 467 a p p e n d i x B ■ Brief JUnit 3.8 tutorial 470 appendix C ■ Brief EasyMock tutorial 473 a p p e n d i x D ■ Running tests with Ant 475 www.it-ebooks.info ix contents preface xvii acknowledgments xix about this book xxi about the cover illustration xxvii PART 1 A TDD PRIMER 1 1 The big picture 3 1.1 The challenge: solving the right problem right 5 Creating poorly written code 5 ■ Failing to meet actual needs 6 1.2 Solution: being test-driven 7 High quality with TDD 8 ■ Meeting needs with acceptance TDD 10 ■ What’s in it for me? 11 1.3 Build it right: TDD 14 Test-code-refactor: the heartbeat 15 ■ Developing in small increments 19 ■ Keeping code healthy with refactoring 24 ■ Making sure the software still works 28 www.it-ebooks.info [...]... software development: Extreme Programming (XP) gave me a new perspective on the right way to develop software What I saw in XP was a combination of the high productivity of my past hack-a-thons and a systematic, disciplined way to work In addition to the fact that XP projects bring the development team closer to the customer, the single biggest idea that struck a chord with me was test-driven development. .. intricacies of TDD, we’ll learn to develop Java and Enterprise Java applications with TDD, and we’ll learn to drive our overall development process with an extension to the core idea of TDD with what we call acceptance test-driven development (acceptance TDD or ATDD) We will drive development on the feature level by writing functional or acceptance tests for a feature before implementing the feature with... reading a book that covers a lot of ground In order to structure the material, we’ve divided the book into three parts with distinct focuses Part 1 introduces the book’s main topics test-driven development and acceptance testdriven development starting with the very basics Chapter 1 begins with a problem statement—the challenges we need to overcome—and explains how TDD and acceptance TDD provide an effective... from adopting TDD Our second intended audience includes Java programmers who aren’t necessarily interested in TDD but who are looking for help in putting their code under test Test-driven development is primarily a design and development technique; but xxi www.it-ebooks.info xxii ABOUT THIS BOOK writing unit tests is such an essential activity in TDD that this book will lend you a hand during pure test-writing,... because there are known cures to these problems Agile software development, 3 including methods such as Extreme Programming (XP) and Scrum, represents the most effective antidote I am aware of The rest of this book will give us a thorough understanding of a key ingredient of the agility provided by these methods—being test-driven 1.2 Solution: being test-driven Just like the problem we’re facing has two parts... you past the steepest learning curve Audience This book is aimed at Java programmers of all experience levels who are looking to improve their productivity and the quality of the code they develop Test-driven development lets you unleash your potential by offering a solid framework for building software reliably in small increments Regardless of whether you’re creating a missile-control system or putting... Singleton 120 Isolate dependencies 122 Inject dependencies 124 ■ ■ 4.5 Unit-testing patterns Assertion patterns 4.6 ■ 127 128 ■ Fixture patterns 132 Working with legacy code ■ Test patterns 137 144 Test-driven legacy development 145 Analyzing the change 146 Preparing for the change 147 Test-driving the change 148 ■ ■ 4.7 Summary ■ 148 PART 2 APPLYING TDD TO SPECIFIC TECHNOLOGIES 151 5 Test-driving web components...x CONTENTS 1.4 Build the right thing: acceptance TDD What’s in a name? 31 a shared language 33 1.5 ■ 31 Close collaboration Tools for test-driven development 32 ■ Tests as 36 Unit-testing with xUnit 36 Test frameworks for acceptance TDD 37 Continuous integration and builds 37 Code coverage 39 ■ ■ 1.6 2 Summary ■ 41 Beginning TDD 43 2.1 From... recognize it and how to deal with it Finally, we go through a long list of things in our toolbox that can facilitate the successful adoption we’re seeking Because writing unit tests is so central to test-driven development, we’ve also provided three brief tutorials on some of the essential tools; you can use them as cheat sheets Appendices A and B are for the JUnit unit-testing framework, illustrating the... improvements introduced in the EJB 3.0 specification You can download the bonus chapter from http://www.manning.com/koskela What’s next? This book should give you enough ammunition to get going with test-driven development, but there’s bound to be a question or two that we haven’t managed to answer in full Fortunately, Manning provides an online forum where you can www.it-ebooks.info xxvi ABOUT THIS BOOK . 31 What’s in a name? 31 ■ Close collaboration 32 ■ Tests as a shared language 33 1.5 Tools for test-driven development 36 Unit-testing with xUnit 36 ■ Test frameworks for acceptance TDD 37 ■ Continuous. patterns 128 ■ Fixture patterns 132 ■ Test patterns 137 4.6 Working with legacy code 144 Test-driven legacy development 145 ■ Analyzing the change 146 ■ Preparing for the change 147 ■ Test-driving. In addition to the fact that XP projects bring the development team closer to the cus- tomer, the single biggest idea that struck a chord with me was test-driven develop- ment ( TDD). The simple idea

Ngày đăng: 29/03/2014, 19:20