Share Point Development With Unit Testing

  • Published on
    20-May-2015

  • View
    1.043

  • Download
    14

Transcript

1. SharePoint Development with Unit TestingJEREMY THAKE 2. OBJECTIVESTo explain the 3 goals of unit testingTo explain where you can unit testTo describe the 3 approaches to unit testing in SharePoint 3. Unit TestingRun quicklyRun on every developer machineMinimal no config(We are not testing MS code) 4. Where to test?ASP.NET Web FormsApplication PagesWeb PartsEvent ReceiversFeature ReceiversWorkflow coding activitiesTimer Jobs 5. WHAT ITS NOT! 6. UNIT TEST 101 SETUP 7. TIGHTLY COUPLED CODE 8. SharePoint + MockingInterfaces are rarely usedSealed classesInternal ConstructorsTypeMockIsolator for SharePoint 9. MOCKING 101 10. NATURAL MOCKS 11. SharePoint Guidance 12. WRAPPERS & faades 13. REPOSITORY 14. MVP Model View Presenter 15. What to test?TDD - lots of code when 80% is usually SharePoint codeTests functionality and requirements workCan cover scenarios and edge casesMissing or empty URL variableValid URL variable syntaxExistence of the specified siteMissing or empty ListName variableExistence of the specified listValid SPListItemCollection return objectNull or empty SPListItemCollection return object 16. MOCKING LARGE AREAS OF SHAREPOINT 17. CONCLUSIONIt not easyLots of codeBenefitswhen refactoringother developers changing itenvironment dependencies reducedspeedDoesn't stop poor quality code:list.Items.CountDispose() 18. JEREMY THAKEhttp://wss.made4the.net@jthake