没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
What readers are saying about
Pragmatic Unit Testing. . .
“This book starts out with a nice introduction discussing
what unit testing is as well as why we should do it. I like the
anecdotes peppered throughout the book illustrating the
point of why one should bother. . . . I also really liked the
analogies you use. It puts the code into a real-world context.”
Sharee L. Johnson,
Project Lead, Applications Development
“I wish I had a copy back when I started doing test-first
development as part of Extreme Programming.”
Al Koscielny, Software Developer
“I’m not totally new to testing, but I’ve struggled with many
aspects of it. I think this book does a good job of bringing
those along who are completely new to unit testing, but still
has enough advanced material to assist those of us who have
dabbled in testing and floundered once we’ve hit obstacles.”
Andrew Thompson,
Consultant, Greenbrier & Russel
“When I’m on a project that needs to be doing unit testing
better (which is often the case), I’d like to have this book
available as a simple reference to suggest to the team.”
Bobby Woolf, Consulting I/T Specialist,
IBM Software Services for Websphere
“I am a firm believer in unit testing and I would want all
team members I work with to be religiously practicing the
techniques recommended in this book. I think there is a lot
of good, practical information in this book that any
professional software engineer should be incorporating into
their daily work.”
James J. O’Connor III,
Lead System Design Engineer
Pragmatic Unit Testing
in Java with JUnit
Andy Hunt
Dave Thomas
The Pragmatic Bookshelf
Raleigh, North Carolina Dallas, Texas
Many of the designations used by manufacturers and sellers to distinguish
their products are claimed as trademarks. Where those designations appear
in this book, and The Pragmatic Programmers, LLC was aware of a trademark
claim, the designations have been printed in initial capital letters or in all
capitals.
Every precaution was taken in the preparation of this book. However, the
publisher assumes no responsibility for errors or omissions, or for damages
that may result from the use of information (including program listings) con-
tained herein.
For information on the latest Pragmatic titles, visit us online:
http://www.pragmaticprogrammer.com
Copyright
c
2003 The Pragmatic Programmers, LLC. All rights reserved. No
part of this publication may be reproduced, stored in a retrieval system, or
transmitted, in any form, or by any means, electronic, mechanical, photo-
copying, recording, or otherwise, without the prior consent of the publisher.
Printed in the United States of America.
ISBN 0-9745140-1-2
Text printed on acid-free paper.
First printing, September 2003
Contents
About the Starter Kit viii
Preface x
1 Introduction 1
1.1 Coding With Confidence . . . . . . . . . . . . . . 2
1.2 What is Unit Testing? . . . . . . . . . . . . . . . 3
1.3 Why Should I Bother with Unit Testing? . . . . 4
1.4 What Do I Want to Accomplish? . . . . . . . . . 5
1.5 How Do I Do Unit Testing? . . . . . . . . . . . . 7
1.6 Excuses For Not Testing . . . . . . . . . . . . . . 7
1.7 Roadmap . . . . . . . . . . . . . . . . . . . . . . 12
2 Your First Unit Tests 13
2.1 Planning Tests . . . . . . . . . . . . . . . . . . . 14
2.2 Testing a Simple Method . . . . . . . . . . . . . 15
2.3 More Tests . . . . . . . . . . . . . . . . . . . . . 20
3 Writing Tests in JUnit 21
3.1 Structuring Unit Tests . . . . . . . . . . . . . . . 21
3.2 JUnit Asserts . . . . . . . . . . . . . . . . . . . . 22
3.3 JUnit Framework . . . . . . . . . . . . . . . . . . 26
3.4 JUnit Test Composition . . . . . . . . . . . . . . 27
3.5 JUnit Custom Asserts . . . . . . . . . . . . . . . 32
3.6 JUnit and Exceptions . . . . . . . . . . . . . . . 33
3.7 More on Naming . . . . . . . . . . . . . . . . . . 35
3.8 JUnit Test Skeleton . . . . . . . . . . . . . . . . 35
剩余162页未读,继续阅读
资源评论
- Sally__Zhang2013-10-09已经有中文版的了,又找了对应的英文版,真真好啊
- 李乐客2018-04-09book is in high quality.
ker79
- 粉丝: 196
- 资源: 1075
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功