1 / 12

Moles Isolation Framework

The Moles Isolation Framework is designed to enhance Test-Driven Development (TDD) processes by allowing the replacement of .NET methods with delegates, facilitating better unit testing in complex environments. This framework supports the mocking of external dependencies and enables the initialization of object properties through well-defined known states. While it offers advantages such as simulating various data types and abstracting system resources, it also poses challenges like increased assembly size and debugging difficulties. Learn about its capabilities, limitations, and best practices in this comprehensive overview.

zalika
Télécharger la présentation

Moles Isolation Framework

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. Moles Isolation Framework

  2. TDD Process

  3. TDD Process Code

  4. TDD Process Code

  5. Stareacunoscuta (Known State) • Se poaterealizaprin: • Initializarea/setareaproprietatilorobiectuluitestat • Emulareadependintelorexterne (mocking)

  6. Stareacunoscuta (Known State) • Se poaterealizaprin: • Initializarea/setareaproprietatilorobiectuluitestat • Emulareadependintelorexterne • Mock objects

  7. Stareacunoscuta (Known State) • Se poaterealizaprin: • Initializarea/setareaproprietatilorobiectuluitestat • Emulareadependintelorexterne • Mock objects • Manual • Mock framework (Rhino Mocks, Moq, TypeMock etc.)

  8. Mock objects • Pot “simula” doarce pot inlocui (override): • Interfete • Clase/metodeabstracte • Metodevirtuale • Nu pot “simula”: • Clase/metodestatice • Metode non-virtuale, sealed • Clase sealed • Clase care nu au fostproiectatepentrutestare • Value types

  9. Moles

  10. Moles Isolation Framework • Conceput initial ca parte a PEX • Permiteinlocuireaoricareimetode .NET cu un delegate • Suporta: • Metodestatice • Metode non-virtuale • Value types (de ex. DateTime)

  11. Avantaje/dezavantaje • Avantaje • Se poatesimula (mock) orice tip de date, oricemetodasioriceproprietate • Permiteimplementarea de unit tests in locul integration tests • Permiteabstractizarearesurselorsistem • Dezavantaje • Timpridicat de initializare • Crestemultdimensiunea assembly-ului de test • Daca se intrerupe debugging-ul, procesul host varamanepornit • Schema de naming explicitapoate duce la situatiidificil de citit MDateTime.TryCreateInt32Int32Int32Int32Int32Int32Int32DateTimeOut

  12. Resurse • Moles: http://research.microsoft.com/en-us/projects/moles/ • Proiect & prezentare: • www.byteflux.me

More Related