KEMBAR78
Unit Testing And Mocking | PPTX
Introduction to Unit Testing and MockingJoe Wilson, PresidentVolare Systems, Inc.Email: joe@volaresystems.comOffice: 303-532-5838, ext 101Web: http://VolareSystems.comBlog: http://VolareSystems.com/BlogTwitter: joe_in_denver
Quick Audience PollWho has done unit testing?Who has tried and given up?
AgendaWhat is unit testing?Step-by-stepWhat is mocking?Dos and Don’ts
What is unit testing?Testing one thing at a time
Not touching anything external (DB, file, etc.)
The developer’s job
Writing and refactoring codeBenefits of unit testingSafer refactoring
Smaller, tighter, decoupled code
Documentation of requirements
Continuous integration
Value of tests increase over timeBenefits of unit testingRev 1Rev 3Rev 2Benefit$CostTime – Life of System
Where does unit testing fit?Still need manual testing, hopefully less
Still need integration testing
Still need user-acceptance testing
May want UI testing
May want performance testingWhat do you need?Testing frameworkNUnit, MSTest, MbUnitTest runnerNUnit, MSTest, ReSharper, TDD.NETMocking frameworkRhino Mocks, Moq, TypeMockWhen do you write the test?Before coding (TDD, BDD)After/During codingFocus on requirements
Thinking about how code will be consumed
Stop coding when reqs met
Harder initially
Focus on code
Thinking about algorithm
More refactoring
Easier initiallyRecipe– Unit Test ProjectOne unit test projectName it after your solution, like *.UnitTestsUse Project Folders inside the project for namespacesSet testing framework and project references

Unit Testing And Mocking