Pragmatic Unit Testing: In Java with JUnit / Edition 1

Paperback (Print)
Used and New from Other Sellers
Used and New from Other Sellers
from $1.99
Usually ships in 1-2 business days
(Save 93%)
Other sellers (Paperback)
  • All (21) from $1.99   
  • New (4) from $12.08   
  • Used (17) from $1.99   
Close
Sort by
Page 1 of 1
Showing All
Note: Marketplace items are not eligible for any BN.com coupons and promotions
$12.08
Seller since 2014

Feedback rating:

(4)

Condition:

New — never opened or used in original packaging.

Like New — packaging may have been opened. A "Like New" item is suitable to give as a gift.

Very Good — may have minor signs of wear on packaging but item works perfectly and has no damage.

Good — item is in good condition but packaging may have signs of shelf wear/aging or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Acceptable — item is in working order but may show signs of wear such as scratches or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Used — An item that has been opened and may show signs of wear. All specific defects should be noted in the Comments section associated with each item.

Refurbished — A used item that has been renewed or updated and verified to be in proper working condition. Not necessarily completed by the original manufacturer.

New
2003-09-01 Paperback New New, We ship one business day with tracking number. We do not ship to CANADA, GU, PR, Hawaii and Alaska.

Ships from: hayward, CA

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
Not Currently Available
$51.97
Seller since 2014

Feedback rating:

(273)

Condition: New
Brand New Item.

Ships from: Chatham, NJ

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
$65.00
Seller since 2014

Feedback rating:

(162)

Condition: New
Brand new.

Ships from: acton, MA

Usually ships in 1-2 business days

  • Standard, 48 States
  • Standard (AK, HI)
$65.00
Seller since 2014

Feedback rating:

(162)

Condition: New
Brand new.

Ships from: acton, MA

Usually ships in 1-2 business days

  • Standard, 48 States
  • Standard (AK, HI)
Page 1 of 1
Showing All
Close
Sort by

Overview

Learn how to improve your Java coding skills using unit testing. Despite it's name, unit testing is really a coding technique, not a testing technique. Unit testing is done by programmers, for programmers. It's primarily for our benefit: we get improved confidence in our code, better ability to make deadlines, less time spent in the debugger, and less time beating on the code to make it work correctly.

This book shows how to write tests, but more importantly, it goes where other books fear to tread and gives you concrete advice and examples of what to test—the common things that go wrong in all of our programs. Discover the tricky hiding places where bugs breed, and how to catch them using the freely available JUnit framework. It's easy to learn how to think of all the things in your code that are likely to break. We'll show you how with helpful mnemonics, summarized in a handy tip sheet (also available from our www.pragmaticprogrammer.com website) to help you remember all this stuff.

With this book you will:

  • Write better code, and take less time to write it
  • Discover the tricky places where bugs breed
  • Learn how to think of all the things that could go wrong
  • Test individual pieces of code without having to include the whole project
  • Test effectively with the whole team

We'll also cover how to use Mock Objects for testing, how to write high quality test code, and how to use unit testing to improve your design skills. We'll show you frequent "gotchas"—along with the fixes—to save you time when problems come up. We'll show you how with helpful mnemonics, summarized in a handy tip sheet (also available from our www.pragmaticprogrammer.com
website).

But the best part is that you don't need a sweeping mandate to change your whole team or your whole company. You don't need to adopt Extreme Programming or Test-Driven Development, or change your development process in order to reap the proven benefits of unit testing. You can start unit testing, the pragmatic way, right away.

Read More Show Less

Product Details

  • ISBN-13: 9780974514017
  • Publisher: Pragmatic Bookshelf
  • Publication date: 9/28/2003
  • Series: Pragmatic Programmers Series
  • Edition description: New Edition
  • Edition number: 1
  • Pages: 176
  • Product dimensions: 7.48 (w) x 8.94 (h) x 0.59 (d)

Meet the Author

Andy Hunt is a programmer turned consultant, author and publisher. He co-authored the best-selling book “The Pragmatic Programmer”, was one of the 17 founders of the Agile Alliance, and co-founded the Pragmatic Bookshelf, publishing award-winning and critically acclaimed books for software developers.

Dave Thomas, as one of the authors of the Agile Manifesto, understands agility. As the author of "Programming Ruby," he understands Ruby. And, as an active Rails developer, he knows Rails.

Read More Show Less

Table of Contents

About the Starter Kit xi
Preface xiii
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
4 What to Test: The Right-BICEP 37
4.1 Are the Results Right? 38
4.2 Boundary Conditions 41
4.3 Check Inverse Relationships 42
4.4 Cross-check Using Other Means 42
4.5 Force Error Conditions 43
4.6 Performance Characteristics 44
5 Correct Boundary Conditions 47
5.1 Conformance 48
5.2 Ordering 49
5.3 Range 51
5.4 Reference 54
5.5 Existence 55
5.6 Cardinality 56
5.7 Time 58
5.8 Try It Yourself 60
6 Using Mock Objects 65
6.1 Simple Stubs 66
6.2 Mock Objects 67
6.3 Testing a Servlet 71
6.4 Easy Mock Objects 74
7 Properties of Good Tests 79
7.1 Automatic 80
7.2 Thorough 81
7.3 Repeatable 83
7.4 Independent 83
7.5 Professional 84
7.6 Testing the Tests 86
8 Testing on a Project 89
8.1 Where to Put Test Code 89
8.2 Test Courtesy 93
8.3 Test Frequency 94
8.4 Tests and Legacy Code 95
8.5 Tests and Reviews 98
9 Design Issues 101
9.1 Designing for Testability 101
9.2 Refactoring for Testing 103
9.3 Testing the Class Invariant 114
9.4 Test-Driven Design 117
9.5 Testing Invalid Parameters 119
A Gotchas 121
A.1 As Long As The Code Works 121
A.2 "Smoke" Tests 121
A.3 "Works On My Machine" 122
A.4 Floating-Point Problems 122
A.5 Tests Take Too Long 123
A.6 Tests Keep Breaking 123
A.7 Tests Fail on Some Machines 124
A.8 My main is Not Being Run 125
B Installing JUnit 127
B.1 Command-line installation 128
B.2 Does it work? 129
C JUnit Test Skeleton 131
C.1 Helper Class 133
C.2 Basic Template 133
D Resources 137
D.1 On The Web 137
D.2 Bibliography 139
E Summary: Pragmatic Unit Testing 141
F Answers to Exercises 143
Read More Show Less

Customer Reviews

Average Rating 4
( 1 )
Rating Distribution

5 Star

(0)

4 Star

(1)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing 1 Customer Reviews
  • Anonymous

    Posted September 27, 2004

    This is a great introductory text for Programmers new to or uncertain about Unit testing.

    Unit testing is `by the developer for the developer¿, it¿s a tool used to ensure code written withstand the tests of time through changes in requirements, bug fixes, and added functionality. Unit (leveraging JUnit) tests are written in Java (there is also a C# version of this text) that live within a testing framework called JUnit and are executed against our application code on a periodic basis (whether that be hourly, daily or at deployment, its up to you) to validate that the code under test continues to perform as per its requirements throughout the project lifecycle. This way we write code that conforms to the `ilities¿, reliability, repeatability, maintainability, and scalability. The book takes you through a nicely sculpted path of learning from the initial `baby-steps¿ Unit testing examples to the more complex day to day challenges of writing loosely coupled Unit tests (using MockObjects) in surrounding environments that include things such as the network, database, or even a Servlet Container. And while winding its way down this path we are also introduced to pearls of wisdom in Chapters titled, `What to Test¿, `Using MockObjects¿, `Properties of Good Tests¿, `Testing on a Project¿, `Design Issues¿, and `Gotchas¿. And finally at the end of the path or text we find a list of very useful testing resources, the text summary, and answers to all exercise questions in the book. This is a definite must have for the programmers tool-kit.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing 1 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)