BN.com Gift Guide

Pragmatic Unit Testing in C# with NUnit

( 1 )

Overview

Learn how to improve your C# 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 ...

See more details below
Available through our Marketplace sellers.
Other sellers (Paperback)
  • All (10) from $1.99   
  • New (1) from $99.49   
  • Used (9) 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
$99.49
Seller since 2014

Feedback rating:

(320)

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
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)
Page 1 of 1
Showing All
Close
Sort by
Sending request ...

Overview

Learn how to improve your C# 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 NUnit 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).

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.

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: 9780974514024
  • Publisher: Pragmatic Programmers, LLC, The
  • Publication date: 5/28/2004
  • Series: Pragmatic Programmers Series
  • Edition number: 1
  • Pages: 176
  • Product dimensions: 7.48 (w) x 8.90 (h) x 0.57 (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 Running Tests with NUnit 16
2.4 Running the Example 22
2.5 More Tests 26
3 Writing Tests in NUnit 27
3.1 Structuring Unit Tests 27
3.2 NUnit Asserts 29
3.3 NUnit Framework 31
3.4 NUnit Test Selection 33
3.5 NUnit Custom Asserts 40
3.6 NUnit and Exceptions 41
3.7 Temporarily Ignoring Tests 42
4 What to Test: The Right-BICEP 45
4.1 Are the Results Right? 46
4.2 Boundary Conditions 49
4.3 Check Inverse Relationships 50
4.4 Cross-check Using Other Means 50
4.5 Force Error Conditions 51
4.6 Performance Characteristics 52
5 Correct Boundary Conditions 55
5.1 Conformance 56
5.2 Ordering 57
5.3 Range 59
5.4 Reference 62
5.5 Existence 63
5.6 Cardinality 64
5.7 Time 66
5.8 Try It Yourself 68
6 Using Mock Objects 73
6.1 Simple Stubs 74
6.2 Mock Objects 75
6.3 Formalizing Mock Objects 79
6.4 When Not To Mock 93
7 Properties of Good Tests 95
7.1 Automatic 96
7.2 Thorough 97
7.3 Repeatable 99
7.4 Independent 99
7.5 Professional 100
7.6 Testing the Tests 102
8 Testing on a Project 105
8.1 Where to Put Test Code 105
8.2 Test Courtesy 108
8.3 Test Frequency 109
8.4 Tests and Legacy Code 110
8.5 Tests and Reviews 113
9 Design Issues 117
9.1 Designing for Testability 117
9.2 Refactoring for Testing 119
9.3 Testing the Class Invariant 130
9.4 Test-Driven Design 132
9.5 Testing Invalid Parameters 134
A Gotchas 137
A.1 As Long As The Code Works 137
A.2 "Smoke" Tests 137
A.3 "Works On My Machine" 138
A.4 Floating-Point Problems 138
A.5 Tests Take Too Long 139
A.6 Tests Keep Breaking 139
A.7 Tests Fail on Some Machines 140
B Resources 141
B.1 On The Web 141
B.2 Bibliography 143
C Summary: Pragmatic Unit Testing 145
D Answers to Exercises 147
Read More Show Less

Customer Reviews

Average Rating 5
( 1 )
Rating Distribution

5 Star

(1)

4 Star

(0)

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 30, 2007

    Great introduction to writing unit tests in C#

    This is a great introduction to writing unit tests in C# with NUnit. The authors do a good job of explaining why unit tests should be created, how having unit tests are better than not having unit tests, and what exactly should be coded for in a unit test. The book is well-written, easy to follow, and includes helpful guidelines for things that might be confusing to developers. The real strength of this book is not the author¿s approach to writing unit tests, but rather they clearly illustrate what exactly should be tested in a unit test. The authors show how adhering to the guidelines they set forth results in unit tests that are well-written and fail at appropriate times. The authors then generalize this to some extent and provide an excellent discussion on the properties of a good unit test. My favorite section of the book was actually one of the appendices. In the first appendix, the authors go through a list of gotchas¿both in writing unit tests in general and specific to unit tests in C#. This is a very short discussion (only 6 pages), but they identify some issues I¿ve seen with poorly written unit tests. This is a great book as an introduction to writing unit tests. The authors clearly explain why unit tests should be written, they show clearly what should be tested in a unit test, and they describe some of the problems that have been avoided by writing intelligent unit tests.

    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)