Benjamin Unit Testing & Test-Driven Development for Mere Mortals.

Slides:



Advertisements
Similar presentations
Software Testing with Visual Studio 2013 & Team Foundation Server 2013 Benjamin Day.
Advertisements

A Brief Introduction to Test- Driven Development Shawn M. Jones.
Real World Scrum with TFS2013 Benjamin Day. Brookline, MA Consultant, Coach, & Trainer Microsoft MVP for Visual Studio ALM Team Foundation Server, Software.
{ Model View Controller ASP.NET By Scott Crooks & Maggie Wettergreen.
How to be a C# ninja in 10 easy steps. Benjamin Day.
Real World Scrum with Team Foundation Server 2013 Benjamin
Design for Testability: Mocks, Stubs, Refactoring, and User Interfaces Benjamin Day benday.com |
Team Foundation Server 2010 Builds: Understand, Configure, and Customize Benjamin Day benday.com |
Design Patterns for MVVM Unit Testing & Testability Benjamin Day.
Real world Windows Phone development Igor
#sqlsatPordenone #sqlsat367 February 28, 2015 Testing your databases Alessandro
CZ Biz. Auto. System & Test-Driven Development Teoman Soygul (Sept 24, 2012).
By Bob Bunson  Simulation of software development project  Fictitious system from Concept to Code  Oriented around the.
From 3 weeks to 30 minutes – a journey through the ups and downs of test automation.
Design for Testability: Mocks, Stubs, Refactoring, and User Interfaces Benjamin Day.
10 Ways to Get Your Project Started Right Benjamin Day.
Coaching Skills for Scrum Masters & The Self-Organizing Team
Presenter - Donn Felker.  Senior Consultant for Microsoft Gold Certified Partner- Statêra.  8 years of experience in developing and architecting enterprise.
@benday #vslive Better Unit Tests through Design Patterns: Repository, Adapter, Mocks, and more… Benjamin
@benday #vslive Automated Build, Test & Deploy with TFS, ASP.NET, and SQL Server Benjamin
Craig Berntson
MVC and MVP. References enter.html enter.html
Todd Snyder Development Team Lead Infragistics Experience Design Group.
Building an Offline Smart Client using Domain-Driven Design Principles Tim McCarthy.
POSTSHARP TECHNOLOGIES Better software through simpler code.
Top 7 Lessons From My First Big Silverlight Project Benjamin Day Benjamin Day Consulting, Inc.
Top 10 Ways to Go from Good to Great Scrum Master Benjamin Day.
Team Foundation Server 2012 Builds: Understand, Configure, and Customize Benjamin Day.
© ALEXANDRE CUVA  VERSION 2.00 Test Driven Design.
Upload your final deck on the speaker portal on or before June 20, 2013 at 5:00 pm PT. PowerPoint presentations undergo a brief scrub process and are.
How to be a C# ninja in 10 easy steps Benjamin Day.
Group C# 023 Dark Deer Hotel. Born in Education: graduated from Oles Honchar Dnipropetrovsk National University, Physics, Electronics and Computer.
A Practical Guide To Unit Testing John E. Boal TestDrivenDeveloper.com.
Refactoring for Testability (or how I learned to stop worrying and love failing tests) Presented by Aaron Evans.
TEST-1 6. Testing & Refactoring. TEST-2 How we create classes? We think about what a class must do We focus on its implementation We write fields We write.
Zero to Hero: Untested to Tested with Visual Studio Fakes Benjamin
Copyright © 2005 Charlie Poole. All rights reserved Test First User Interfaces XP2005 Sheffield University June 18, 2005.
Coaching Skills for Scrum Masters & The Self- Organizing Team.
Real World SQL Server Data Tools Benjamin
To Git or Not to Git for Enterprise Development Benjamin Edward Thomson
ASP.NET MVC An Introduction. What is MVC The Model-View-Controller (MVC) is an architectural pattern separates an application into three main components:
Automated Testing for Dynamics CRM
Benjamin Day Get Good at DevOps: Feature Flag Deployments with ASP.NET, WebAPI, & JavaScript.
Benjamin Day Role-based Security Stinks: Better Authorization in ASP.NET.
Beyond Basic Unit Testing: Mocks, Stubs, User Interfaces, and Refactoring for Testability Benjamin Day
Ognjen Bajić Ana Roje Ivančić Ekobit Efficient Application Testing.
Benjamin Day Real World Scrum with TFS 2015 & VSTS.
1 © Agitar Software, 2007 Automated Unit Testing with AgitarOne Presented by Eamon McCormick Senior Solutions Consultant, Agitar Software Inc. Presented.
DevOps with ASP.NET Core and Entity Framework Core
Real world Windows Phone development
Better Unit Tests through Design Patterns: Repository, Adapter, Mocks, and more… Benjamin
Unit testing your metro style apps built using XAML
Building Custom Workflows
Top 10 Mistakes in Unit Testing
Unit Testing in a Team Sparkhound Presents by Steve Schaneville
Entity Framework Core for Enterprise Applications
Unit Testing & Test-Driven Development for Mere Mortals
Unit testing C# classes
Unit Testing & Test-Driven Development for Mere Mortals
Get Good at DevOps: Feature Flag Deployments with ASP
Zero to Hero: Untested to Tested with Visual Studio Fakes
Unit Testing & Test-Driven Development for Mere Mortals
Real World Scrum with TFS & VSTS / Azure DevOps
From Development to Production: Optimizing for Continuous Delivery
2/24/2019 © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks.
Non-Useless Unit Testing for Entity Framework Core & ASP.NET Core
Entity Framework Core for Enterprise Applications
Implementing Security in ASP.NET Core: Claims, Patterns, and Policies
From Development to Production: Optimizing for Continuous Delivery
Designing For Testability
Presentation transcript:

Benjamin Unit Testing & Test-Driven Development for Mere Mortals

Benjamin Day Brookline, MA Consultant, Coach, & Trainer Microsoft MVP for Visual Studio ALM Scrum, Team Foundation Server, Software Testing, Software Architecture Scrum.org Classes – Professional Scrum Master (PSM) – Professional Scrum Developer (PSD) – Professional Scrum Foundations (PSF)

Got ?

@benday Overview What is a unit test? What is unit testing? Why do I care? How do I justify it to my self/boss/team? Design for testability Demos

@benday Unit tests = Small chunks of code that test other small chunks of code

@benday Typical Unit Testing Flow You’re writing a feature You’re also writing tests Feature code = the “System Under Test” (aka. “SUT”) At least one unit test method per public method on the SUT Asserts

@benday Demo: Calculator Unit Tests

@benday Why use unit tests?

@benday Typical Development Flow You write code It appears to work You check it in You send it to QA QA sends back bugs You fix (repeat)

@benday Typical Refactoring Flow You refactor code You write some new code, too You check it in It appears to work You send it to QA They send bugs You fix bugs You deploy to production The world lights on fire

@benday $$$

@benday $1m for IT to support an application. That’s looking grim.

@benday Technical Debt

@benday Technical Debt Little bits of not-quite-done Low-quality code 8 million line methods Coding standards violations Classes with unclear names and intent Buggy & Brittle

@benday Unit tests can help tackle technical debt

@benday Unit tests can help tackle technical debt That’s looking grim.

@benday Unit Tests Proof that the code you’re writing actually works Run-able by a computer Proof that the code you wrote a long time ago still works Automated regression tests Proof that bugs are still fixed

@benday Awesome side effects of unit tests Focus on quality early Don’t rely on QA to tell you your code is broken Fewer low-value bugs coming back from QA NullReferenceException QA can focus on “exploratory testing” Better use of QA’s time Refactor with confidence Keep your code clean Clean code is easier to read % time reading code vs. % time writing code Clean code is easier to build on top of

@benday How I structure a unit test Unit test class tests a class in the system under test {NameOfSystemUnderTestClass}Fixture.cs Has a property called SystemUnderTest Typeof {NameOfSystemUnderTestClass} [TestInitialize] method called OnTestInitialize() One or more [TestMethod] Arrange Act Assert

@benday Unit Tests vs. Integration Tests

@benday How would you test this?

@benday What is Design For Testability? Build it so you can test it. How would you test this? Do you have to take the plane up for a spin?

@benday Interfaces, Dependency Injection, & Mocks Code against interfaces Dependency Injection “Advertise” your dependencies on the constructor Dependencies are references to interfaces Use mock classes to provide fake data

@benday Advertise Dependencies on Constructor Less AwesomeNow With More Awesome

@benday Hard to test usually also means hard to maintain.

@benday Design Patterns will help you to create a more testable & maintainable application.

@benday What’s a Design Pattern? Well-known and accepted solution to a common problem Avoid re-inventing the wheel

Design patterns in architecture.

@benday Popularized in Software by this book…

@benday Design Patterns for this talk Dependency Injection Flexibility Repository Data access details Adapter Keeps tedious, bug-prone code contained Strategy Encapsulates algorithms & business logic Model-View-Controller Isolates User Interface Implementation from the User Interface Logic Testable User Interfaces Model-View-ViewModel

@benday Repository Pattern Hide the existence of databases and services Hide the existence of Entity Framework & ADO.NET Code against an interface Allows you to use mock data without an actual database Separate Unit Tests from Integration Tests

@benday Adapter Pattern Isolate the details of turning one object into another object To / from Entity Framework entities To / from WebAPI message types To / from ASP.NET MVC ViewModels and Models

@benday Model-View-Controller (MVC) Test user interfaces without having to run an actual user interface ASP.NET MVC WPF / XAML Model-View-ViewModel (MVVM)

@benday Strategy Pattern Isolate and test algorithms Validation Business rules

@benday Demos

Thank you. |