testing unitario con microsoft fakes

Download Testing Unitario Con Microsoft Fakes

Post on 29-Dec-2015

99 views

Category:

Documents

4 download

Embed Size (px)

TRANSCRIPT

  • Testing Unitario con Microsoft Fakes - Prlogo

    Page 1 of 82

  • Testing Unitario con Microsoft Fakes - Prlogo

    Page 2 of 82

    La informacin contenida en este documento representa la visin Microsoft Corporation sobre los asuntos

    analizados a la fecha de publicacin. Dado que Microsoft debe responder a las condiciones cambiantes del

    mercado, no debe interpretarse como un compromiso por parte de Microsoft, y Microsoft no puede garantizar la

    exactitud de la informacin presentada despus de la fecha de publicacin.

    Este documento es slo para fines informativos. MICROSOFT NO OFRECE NINGUNA GARANTA, EXPRESA,

    IMPLCITA O LEGAL, EN CUANTO A LA INFORMACIN CONTENIDA EN ESTE DOCUMENTO.

    Microsoft publica este documento bajo los trminos de la licencia Creative Commons Attribution 3.0 License.

    Todos los dems derechos estn reservados.

    2013 Microsoft Corporation.

    Microsoft, Active Directory, Excel, Internet Explorer, SQL Server, Visual Studio, and Windows son marcas

    comerciales del grupo de compaas de Microsoft.

    Todas las dems marcas son propiedad de sus respectivos dueos

    The information contained in this document represents the current view of Microsoft Corporation on the issues

    discussed as of the date of publication. Because Microsoft must respond to changing market conditions, it

    should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the

    accuracy of any information presented after the date of publication.

    This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR

    STATUTORY, AS TO THE INFORMATION IN THIS DOCUMENT.

    Microsoft grants you a license to this document under the terms of the Creative Commons Attribution 3.0

    License. All other rights are reserved.

    2013 Microsoft Corporation.

    Microsoft, Active Directory, Excel, Internet Explorer, SQL Server, Visual Studio, and Windows are trademarks of

    the Microsoft group of companies.

    All other trademarks are property of their respective owners.

  • Testing Unitario con Microsoft Fakes - Prlogo

    Page 3 of 82

    ndice Prlogo ........................................................................................................................................................................................................................................6

    Introduccin ..............................................................................................................................................................................................................................7

    Audiencia ............................................................................................................................................................................................. 7

    Visual Studio ALM Rangers .......................................................................................................................................................... 7

    Autores ................................................................................................................................................................................................. 8

    Uso del cdigo fuente, erratas y soporte ............................................................................................................................... 8

    Captulo 1: Breve teora sobre Testing Unitario .........................................................................................................................................................9

    Testing de software .............................................................................................................................................................................. 9

    Estrategias de testing ..................................................................................................................................................................... 9

    Tipos de tests ..................................................................................................................................................................................... 9

    La delgada lnea entre buen y mal test unitario ..................................................................................................................... 11

    Porqu son importantes los test unitarios ........................................................................................................................... 11

    Define un paradigma de desarrollo guiado por tests unitarios................................................................................... 11

    Checklist de un test unitario ...................................................................................................................................................... 13

    Captulo 2: Introduccin a Microsoft Fakes .............................................................................................................................................................. 14

    Stubs ......................................................................................................................................................................................................... 14

    Qu testeamos? ............................................................................................................................................................................ 14

    Por qu usar Stubs? ..................................................................................................................................................................... 15

    Shims ........................................................................................................................................................................................................ 16

    Elegir entre un stub o un shim ....................................................................................................................................................... 18

    Captulo 3: Migrando a Microsoft Fakes .................................................................................................................................................................... 19

    Migrando de Moles a Microsoft Fakes ....................................................................................................................................... 19

    Cambiando referencias ................................................................................................................................................................ 19

    La forma de hacer fakes ............................................................................................................................................................... 19

    Definiendo comportamientos ................................................................................................................................................... 20

    Moles y Microsoft SharePoint ................................................................................................................................................... 20

    Migrando de frameworks comerciales y open source ......................................................................................................... 20

    Introduccin ..................................................................................................................................................................................... 20

    Diferencias entre estos productos y Microsoft Fakes ...................................................................................................... 21

    Migrando desde Moq ................................................................................................................................................................... 22

    Migrando desde RhinoMocks ................................................................................................................................................... 32

    Conclusin ......................................................................................................................................................................................... 35

    Captulo 4: FAQ ..................................................................................................................................................................................................................... 36

    Trabajando con .NET Framework 4 .............................................................................................................................................. 36

  • Testing Unitario con Microsoft Fakes - Prlogo

    Page 4 of 82

    Adoptando Microsoft Fakes en un equipo ............................................................................................................................... 36

    No se pueden hacer fakes de todo! ........................................................................................................................................... 36

    Logging detallado ............................................................................................................................................................................... 37

    Trabajando con assemblies con strong names ....................................................................................................................... 37

    Optimizando la generacin de Fakes .......................................................................................................................................