1 / 12

Unit Testing

Unit Testing. Secrets of an Umbraco Ninja. Presented by : Aaron Powell. me@aaron-powell.com. @ slace. www.aaron-powell.com. What and Why?. Not Test Driven Development Separation of logic from UI Ability to create reusable components

wilmet
Download Presentation

Unit Testing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Unit Testing • Secrets of an Umbraco Ninja • Presented by: • Aaron Powell me@aaron-powell.com @slace www.aaron-powell.com

  2. What and Why? • Not Test Driven Development • Separation of logic from UI • Ability to create reusable components • Reduced errors by repeatable tests in controlled environments • Better API design

  3. Stub & Mocks • Stub is an instance which wont break your test • Stubs can be implementations of a class created purely for testing purposes • Mocks • Less common in current unit testing • Type instances where nothing is defined • Can be very brittle

  4. Frameworks • Do you need a mocking framework? • Short answer is no • Can create your own stub types • Gives you greater control • Why to use one? • Easy expectation setup • Using stubs on less accessible types • Set-less properties

  5. Development • WebForms MVP to abstract away ASP.NET WebForms features • Dependency Injection to simplify the creation of factory types • Factory Pattern for data access

  6. With Umbraco • Heavy reliance of HttpContext • Hard to Mock • Requires a web context • Lots of static • Hard to mock • Changing data • What are we working against?

  7. Ninja Coding!

  8. Questions? Thank you for coming 

More Related