Test First Development - Part 1

Test first development techniques and practices with C#, Visual Studio, and NUnit
Course info
Rating
(1218)
Level
Intermediate
Updated
Nov 16, 2010
Duration
3h 33m
Table of contents
Introduction to Test-First Development
Writing Unit Tests Part I
Writing Unit Tests II
Introduction to Refactoring
Driving Design with Unit Tests
Isolating Code
Description
Course info
Rating
(1218)
Level
Intermediate
Updated
Nov 16, 2010
Duration
3h 33m
Description

This course introduces a test-first development style to build better software. We’ll discuss the value of unit testing and demonstrate the red-green-refactor workflow in the design and implementation of business requirements. Using tools like NUnit and JetBrains Resharper we’ll also demonstrate tips and practices for refactoring, and writing effective unit tests. This course is appropriate for developers new to the practice of writing unit tests.

About the author
About the author

David Starr is Director of Technical Learning at GoDaddy, Inc. He specializes in agile software development practices, patterns and practices, and judicious application of various technologies within development teams. He is a 5 time Microsoft MVP in Visual Studio and a technical instructor with Pluralsight where he focuses on the software development practices and developer tooling curricula. David blogs at ElegantCode.com, is a frequent contributor at conferences and a frequent writer. He has successfully led many product development teams and is a technical learning professional.

More from the author
Client Side React Router 4
Intermediate
1h 59m
2 Mar 2018
Getting Started with IntelliJ CE
Beginner
2h 47m
1 Sep 2017
Big Scrum
Intermediate
2h 47m
22 Apr 2015
More courses by David Starr
About the author

Scott has over 15 years of experience in commercial software development and is a frequent speaker at national conferences, and local user groups. Scott is a Microsoft MVP and has authored books on several Microsoft technologies, including ASP.NET, C#, and Windows Workflow.

More from the author
More courses by Scott Allen
Section Introduction Transcripts
Section Introduction Transcripts

Introduction to Test-First Development
Welcome to this Introduction to Test First Development. My name is David Starr, and in this course we'll provide a gentle introduction to unit testing and the grander scheme of test-driven development. Now this conversation has become louder in recent years, because while these techniques were originally associated with the agile software development movement, it's now fairly recognized that using developer testing and developing our systems in a test first way is simply a valuable software engineering practice regardless of what methodology we happen to be following. Now, in this course, we'll have an introduction to developer testing in which we try and answer the question what is the difference between developer's testing and tester's testing? We'll then look at some of the more common unit testing frameworks for. NET developers and then see how we can take advantage of those frameworks to develop code in a test first manner. And finally, we'll briefly visit some practices beyond test-driven development that are also considered test first practices. I'll warn you now, you're about to take the first step on a long and rewarding road of test first development. Developing code this way has a tendency to become somewhat addictive, and once you've been exposed to this model of developing software, it's often very hard to go back.

Writing Unit Tests Part I
Hi, this is Scott Allen of Pluralsight, and in this module we're going to be writing unit tests, and we're going to write those unit tests using a test first development style. In this module, I'll walk you through the basics of getting set up with a test project that will work with NUnit, we'll talk about applying the correct test attributes so that NUnit can identify your test code, I'll show you how to set up Test Fixtures with the test inside, we'll execute the test using a couple different test runners, and by the end of the module, I also want to give you some tips and guidance on good unit testing practices and test first development in general.

Introduction to Refactoring
Hi, this is Scott Allen from Pluralsight, and this module is an introduction to refactoring. Refactoring is an important step in the test first development cycle. When we refactor software, we're making changes to the internals of a class, perhaps a set of classes, a library, or even entire application. But the clients of the software do not see a change in the functionality. The changes we're making might involve adding additional abstractions, renaming variables, restructuring code, or even rewriting an implementation completely from scratch. We're changing the internal implementation. But when we refactor, our customers who use the software on a daily basis, they won't see a change in how the application behaves. Although after we're done refactoring, an application might perform better, that's a topic we'll talk about later in this module. Unit tests are also considered clients of our software. They consume the API in classes we design. When we refactor the internals of one of those classes, the unit test shouldn't see a difference in behavior. When the refactoring is complete, the test should still pass. So the question you might be asking at this point is if nothing changes on the outside, why do we bother with refactoring? This is one of the questions I'll answer in this module. I'll demonstrate why we should refactor, when we should refactor, and how we should refactor.

Driving Design with Unit Tests
Hello, this is David Starr and in this the final module of our Test First Development Introduction course, we're going to take a passing look at how test first development affects the design of the system under test that we're creating. Now this a rich and deep subject worthy of lots of discussion, but we'll have more of that discussion in future courses that take on more advanced subjects of test first development. This is really introducing the idea that designing with testability in mind does indeed impact the design of our system under test. In this module, we'll discuss the benefits to our system under test design that are derived from using test first development practices. We'll also see how singletons might influence the way we interact with our system under test in the test that we create for it. We'll see how to drive looser coupling between classes in our SUT using tests. And this idea is inextricably tied to those of separating our concerns within our class structure and inverting dependency. All of these subjects have treatment in other courses in the Pluralsight on-demand library, but we're going to see in particular how test first development influences these ideas.