We think you have liked this presentation. If you wish to download it, please recommend it to your friends in any social system. Share buttons are a little bit lower. Thank you!
Presentation is loading. Please wait.
Published bySade Beaver
Modified over 2 years ago
Writing Unit Tests with Microsoft Fakes Copyright © Intertech, Inc. 2013 www.Intertech.com 800-866-9884 Slide 1 Writing Unit Tests with Microsoft Fakes A Consulting Division Presentation Month Date, 2006 © All Rights Reserved Tim Star firstname.lastname@example.org http://www.intertech.com/Blog/ http://timsbrownbaglunch.blogspot.com/ /
Writing Unit Tests with Microsoft Fakes Copyright © Intertech, Inc. 2013 www.Intertech.com 800-866-9884 Slide 2 Experience Principal Consultant /.Net Architect Visual Studio ALM Ranger – 5 years MS Testing tools consulting and training Load testing Development Manager MCPD Enterprise App Development 3.5/4.0 Framework MCTS WPF/TFS MCP – VS ALM and Testing with MTM MCT 4 X Microsoft MVP
Writing Unit Tests with Microsoft Fakes Copyright © Intertech, Inc. 2013 www.Intertech.com 800-866-9884 Slide 3 Agenda Unit testing Why Design Principles for testability What is the Fakes framework How does it help How does it work Stubs Shims How Do I choose Resources Demo
Writing Unit Tests with Microsoft Fakes Copyright © Intertech, Inc. 2013 www.Intertech.com 800-866-9884 Slide 4 Why Unit test Make sure the code works Refactor with confidence Support emerging design Find errors and design flaws early - $ Get a quick understanding of the quality of code
Writing Unit Tests with Microsoft Fakes Copyright © Intertech, Inc. 2013 www.Intertech.com 800-866-9884 Slide 5 Design Principles for testability Single responsibility principle (SRP) Open Closed Principle (OCP) Liskov Substitution Principle (LSP) Interface Segregation Principle (ISP) Dependency Inversion Principle (DIP) Dont Repeat Yourself (DRY) You Arent Going to Need It (YAGNI) Great resource: Agile Principles, Patterns, and Practices in C#
Writing Unit Tests with Microsoft Fakes Copyright © Intertech, Inc. 2013 www.Intertech.com 800-866-9884 Slide 6 What is the Microsoft Fakes Framework? Microsoft Fakes is a framework that enables us to isolate the code we are testing by replacing dependencies of our code with stubs or shims. The Fakes Framework in Visual Studio 2012 is the next generation of Moles & Stubs. (Read: migrate not upgrade) Available in VS 2012 Ultimate or VS 2012 Premium beginning with Update 2 Works with.Net framework 2.0 and Above
Writing Unit Tests with Microsoft Fakes Copyright © Intertech, Inc. 2013 www.Intertech.com 800-866-9884 Slide 7 How does the Fakes framework Help Allows us to quickly implement doubles to support testing in isolation Allows us to decouple from slow running dependencies like DB, file system, message system. Decoupling allows us to write order independent unit tests Stage data in test methods, not in a DB. One unit test failure will not cause a chain reaction No need to reset a database to a golden state. Allows us to intercept calls to dependencies we do not control.
Writing Unit Tests with Microsoft Fakes Copyright © Intertech, Inc. 2013 www.Intertech.com 800-866-9884 Slide 8 Stubs and Shims Stubs – Code generator that generates classes that implement interfaces. Uses delegates so our tests supply the implementation. Shims – Modifies code at runtime to intercept calls to dependencies. (Read: slower) Accepts delegates so tests can provide alternate implementation.
Writing Unit Tests with Microsoft Fakes Copyright © Intertech, Inc. 2013 www.Intertech.com 800-866-9884 Slide 9 Choosing between stubs and shims Performance. Shims run slower because they rewrite your code at run time. Stubs do not have this performance overhead and are as fast as virtual methods can go. Static methods, sealed types. You can only use stubs to implement interfaces. Therefore, stub types cannot be used for static methods, non-virtual methods, sealed virtual methods, methods in sealed types, and so on. Internal types. Both stubs and shims can be used with internal types that are made accessible by using the assembly attribute InternalsVisibleToAttribute. Private methods. Shims can replace calls to private methods if all the types on the method signature are visible. Stubs can only replace visible methods. Interfaces and abstract methods. Stubs provide implementations of interfaces and abstract methods that can be used in testing. Shims cant instrument interfaces and abstract methods, because they dont have method bodies. http://msdn.microsoft.com/en-us/library/hh549175.aspx
Writing Unit Tests with Microsoft Fakes Copyright © Intertech, Inc. 2013 www.Intertech.com 800-866-9884 Slide 10 Resources MSDN - http://msdn.microsoft.com/en- us/library/hh549175.aspxhttp://msdn.microsoft.com/en- us/library/hh549175.aspx 2 Day Unit Testing Course - http://www.intertech.com/Training/Microsoft/ Visual-Studio/Unit-Testing/Unit-Testing-in- Visual-Studio-2012#axzz2a6ibYDAM http://www.intertech.com/Training/Microsoft/ Visual-Studio/Unit-Testing/Unit-Testing-in- Visual-Studio-2012#axzz2a6ibYDAM ALM Rangers eBook - http://vsartesttoolingguide.codeplex.com/rel eases/view/102290 http://vsartesttoolingguide.codeplex.com/rel eases/view/102290 http://www.peterprovost.org/blog/2012/04/1 5/visual-studio-11-fakes-part-1/http://www.peterprovost.org/blog/2012/04/1 5/visual-studio-11-fakes-part-1/
SOLID Object Oriented Design Craig Berntson
Automating Server-based Build, QA & Test with Visual Studio 2012 Neno Loje Consultant & MVP for Visual Studio ALM, TFS, and Scrum
Modern Application Lifecycle Visual Studio Online journey, capabilities and DevOps Scenarios Good to know.
Design Principles & Patterns Some of my favorite patterns, practices, and other stuff.
Company Confidential – Do Not Duplicate 2 Copyright 2008 McLane Advanced Technologies, LLC S.O.L.I.D. Software Development Achieving Object Oriented Principles,
SOLID Design Principles. SOLID Stands For Single responsibility Open-closed Liskov substitution Interface segregation Dependency inversion The principles,
.NET 3.5 SP1 New features Enhancements Visual Studio 2008 SP1 New features Enhancements Additional features/enhancements.
Stuart Kent Group Program Manager, Visual Studio Follow team coding activity with CodeLens.
Build Robust Web Apps in the Real WakeUpAndCode.com.
Entity Framework Code First Migrations By Shahed Chowdhuri Dont drown in database design during WakeUpAndCode.com.
Software Testing with Visual Studio 2013 & Team Foundation Server 2013 Benjamin Day.
What's new in Microsoft Visual C March 17 th 2014 Marc Grégoire
Development Life Cycle using Visual Studio Team Edition for DB Professionals Richard Fennell Engineering Director SQLBits II Birmingham 1 st March 2008.
Neelesh Kamkolkar Sr. Product Manager/Planner | Microsoft
Black marble the strategic IT asset for your organisation DEVELOPMENT LIFE CYCLE USING VISUAL STUDIO TEAM EDITION FOR DB PROFESSIONALS Richard Fennell.
(Advanced) Web Application Development Test Driven Development with Ruby and Rails Bruce Scharlau, University of Aberdeen, 2013.
Dev and Test Environments in the Cloud Jim Bowyer – Cloud Solution Architect Mitch Barnett – Developer Platform Specialist.
Unit Testing Beyond Mock Objects Sven Rosvall ACCU 2014.
GETTING STARTED WITH WINDOWS COMMUNICATION FOUNDATION 4.5 Ed Jones & Grey Guindon.
Automated Testing for Dynamics CRM Unit Testing Plug-Ins Wael Hamze Ramon Tebar.
Ognjen Bajić Ana Roje Ivančić Ekobit Efficient Application Testing.
Developer Tester Architect IT / Project Manager BusinessAnalyst Designer Database Professional Team Collaboration Software Quality Project Transparency.
Źródło:http://msdn.microsoft.com/en-us/library/ms aspxhttp://msdn.microsoft.com/en-us/library/ms aspx.
Introduction to SOLID Principles. Background Dependency Inversion Principle Single Responsibility Principle Open/Closed Principle Liskov Substitution.
1 Software Engineering: A Practitioner’s Approach, 6/e Chapter 11a: Component-Level Design Software Engineering: A Practitioner’s Approach, 6/e Chapter.
Design for testability as a way to good coding Simone Chiaretta Architect, Council of the EU December 9 th,
.NET 4.0 Code Contacts .NET 4.0 Code Contracts About Me James Newton-King Developer at Intergen Blog:
Introduction to Aspect Oriented Programming with Cirrus and Delphi Prism Jim McKeeth | Podcast at Delphi.org.
@benday #vslive Better Unit Tests through Design Patterns: Repository, Adapter, Mocks, and more… Benjamin
Build Robust Web Apps in the Real WakeUpAndCode.com * aka ASP.NET 5 before RC1.
Microsoft Office Project and Project Server Reporting May 12 th, 2009 Chris Oxtoby, MCP – Principal Consultant, Pcubed.
Refactoring for Testability (or how I learned to stop worrying and love failing tests) Presented by Aaron Evans.
Building Localized Applications with Microsoft.NET Framework and Visual Studio.NET Achim Ruopp International Program Manager Microsoft Corp.
SOLID Principles in Software Design SOLID, DRY, YAGNI, KISS Svetlin Nakov Technical Trainer Software University
Doing Something Useful with Enterprise Library 3.0 Benjamin Day Level: Intermediate.
Zero to Hero: Untested to Tested with Visual Studio Fakes Benjamin
DevScopeInnovation EventSandro Pereira Azure Service Bus EAI/EDI.
DESIGN PATTERN PRESENTATION AND DISCUSSION RAJAT ARYA EFECS * OIM Model-View Controller.
SOLID Principles in Software Design SOLID, DRY, YAGNI, KISS Software University Technical Trainers SoftUni Team.
Black marble the strategic IT asset for your organisation MAKING THE SQL DEVELOPER ONE OF THE FAMILY WITH VISUAL STUDIO TEAM SYSTEM Richard Fennell Engineering.
C# kursus Rohde & Schwarz1 Object Relational Mapping – ORM Entity Framework.
Mick Badran – BizTalk MVP Training and Integration Specialist Breeze SOA314.
Benjamin Unit Testing & Test-Driven Development for Mere Mortals.
Presented by Srini CAPAREA SPONSORS AUDIENCE.
Session 33 More on SOLID Steve Chenoweth Office: Moench Room F220 Phone: (812) Chandan Rupakheti Office: Moench.
Pricing Changes MSDN subscriptions Stand- alone tool Team collaboration Release management Visual Studio Team Foundation Server Device CAL Visual Studio.
OPEN XML SDK FOR MICROSOFT OFFICE John DeVight September 21, 2013 TechGate 2013 – Reston, VA.
1 19-Jan-14 © Copyright: City Boy Salary : Simon Powers : 2014 Brown Bag – Behaviour Driven Development with Specflow Brown Bag – Behaviour Driven Development.
SQL Server Compression Estimation Presented by Warwick Rudd –
© 2017 SlidePlayer.com Inc. All rights reserved.