Tài liệu Pragmatic Unit Testing in C# with NUnit pptx

220 871 1
Tài liệu Pragmatic Unit Testing in C# with NUnit pptx

Đ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

[...]... asked, or try an experiment live on a computer before continuing Language-specific Versions As of this printing, Pragmatic Unit Testing is available in two programming language-specific versions: • in Java with JUnit • in C# with NUnit Acknowledgments from the First Edition We’d especially like to thank the following Practitioners for their valuable input, suggestions, and stories: Mitch Amiano, Nascif Abousalh-Neto,... use testing effectively in your project in Chapter 8 This chapter also discusses how to handle existing projects with legacy code We’ll then talk about how testing can in uence your application’s design (for the better) in Chapter 9, Design Issues We then wrap up with an overview of GUI testing in 10 The appendices contain additional useful information: a look at common unit testing problems, extending... perhaps much more formal testing depending on your environment But testing, as with charity, begins at home 1.3 Why Should I Bother with Unit Testing? Unit testing will make your life easier.3 Please say that with us, out loud Unit testing will make your life easier That’s why we’re here It will make your designs better and drastically reduce the amount of time you spend debugging We like to write code,... experience with unit testing But while the examples are in C#, using the NUnit framework, the concepts remain the same whether you are writing in C++, Fortran, Ruby, Smalltalk, or VisualBasic Testing frameworks similar to NUnit exist for over 60 different languages; these various frameworks can be downloaded for free.2 1 http://www.pragmaticprogrammer.com/titles/utc2 2 http://www.xprogramming.com/software.htm... project and personal success Unit testing is a relatively inexpensive, easy way to produce better code, faster Unit testing is the practice of using small bits of code to exercise the code you’ve written In this book, we’ll be using the NUnit testing framework to help manage and run these little bits of code Many organizations have grand intentions when it comes to testing, but tend to test only toward... has done unit testing before, we hope there will be a couple of nice surprises for you here Skim over the basics of using NUnit and concentrate on how to think about tests, how testing affects design, and how to handle certain team-wide issues you may be having And remember that this book is just the beginning It may be your first book on unit testing, but we hope it won’t be your last Where To Find The... approach Which brings us to unit testing As we’ll see, unit testing is important to you as a programmer because it provides the feedback you need Without unit testing, you may as well be writing programs on a yellow legal pad and hoping for the best when they’re run That’s not very pragmatic This book can help It is aimed primarily at the C# programmer who has some experience writing and designing code, but... supposed to do • Unit tests are not maintained: tests are ignored (or deleted) forever if they start failing, or no new unit tests are added, even when bugs are encountered that illustrate holes in the coverage of the unit tests If you find any of these symptoms, then your team is not unit testing effectively or optimally Have everyone read up on unit 14 R OADMAP testing again, go to some training, or try... remains open as to whether that’s the right thing to do according to the customer or end-user: that’s what acceptance testing is for We’re not really concerned with formal 1 Because Dale had been integrating all along via the unit tests 3 W HY S HOULD I B OTHER WITH U NIT T ESTING ? validation and verification or correctness just yet We’re really not even interested in performance testing at this point... at common unit testing problems, extending NUnit itself, a note on installing NUnit, and a list of resources including the bibliography We finish off with a summary card containing highlights of the book’s tips and suggestions So sit back, relax, and welcome to the world of better coding 15 Chapter 2 Your First Unit Tests As we said in the introduction, a unit test is just a piece of code It’s a piece . www.XProgrammin g.com Pragmatic Unit Testing in C# with NUnit, Second Edition Andy Hunt Dave Thomas with Matt Hargett The Pragmatic Bookshelf Raleigh, North Carolina. more formal testing depending on your environment. But testing, as with charity, begins at home. 1.3 Why Should I Bother with Unit Tes ting? Unit testing will

Ngày đăng: 16/02/2014, 13:20

Từ khóa liên quan

Mục lục

  • About the Starter Kit

  • Preface

  • Introduction

    • Coding With Confidence

    • What is Unit Testing?

    • Why Should I Bother with Unit Testing?

    • What Do I Want to Accomplish?

    • How Do I Do Unit Testing?

    • Excuses For Not Testing

    • Roadmap

    • Your First Unit Tests

      • Planning Tests

      • Testing a Simple Method

      • Running Tests with NUnit

      • Running the Example

      • More Tests

      • Writing Tests in NUnit

        • Structuring Unit Tests

        • Classic Asserts

        • Constraint-based Asserts

        • NUnit Framework

        • NUnit Test Selection

        • More NUnit Asserts

Tài liệu cùng người dùng

Tài liệu liên quan