Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Macedonian Visual C# user group           https://www.facebook.com/mkvcsughttp://mkdot.net/community/mknetug/mk_vcs/defaul...
Why test software• Bugs are bad, m’kay?• Provides demonstrative proof that business  requirements have been met• Reduces r...
Why unit test software• White – box testing• Created by people with best knowledge of the  system• Unit testing promotes f...
Unit testing myths• “Testers test, developers develop”• “Its dull to write tests.”• “There’s no time to write tests.”• “We...
Unit testing myths• “Unit testing is weak at finding problems  that haven’t been considered.”• “It takes too much time and...
Unit testing myths•   “It saves money”•   “It reduces the number of bugs”•   “It brings a higher code quality”•   “It impr...
Fakes and Stubs and Mocks, oh my• Dummy  Just a placeholder object, unused and unusable• Stub  A placeholder implementatio...
How to unit test in .net•   NUnit•   MSTest•   TestDriven•   Moq•   RhinoMocks•   Typemock•   Microsoft Fakes•   …
DEMO
Is unit-testing TDD?• NO• Test-before development  – red / green / refactor• Test-after development
DEMO
?
Upcoming SlideShare
Loading in …5
×

Fake Mocking Dummy - Unit Testing in .net

1,263 views

Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Fake Mocking Dummy - Unit Testing in .net

  1. 1. Macedonian Visual C# user group https://www.facebook.com/mkvcsughttp://mkdot.net/community/mknetug/mk_vcs/default.aspx Fake Mocking Dummy Wekoslav Stefanovski swekster@gmail.com sweko@mtdot.net
  2. 2. Why test software• Bugs are bad, m’kay?• Provides demonstrative proof that business requirements have been met• Reduces risk of failures (or incidents) once systems are transferred to live operation• Assures that the users for which the solution was designed are able to operate productively. – Performant – Reliable – Secure (and safe)• When to stop testing?
  3. 3. Why unit test software• White – box testing• Created by people with best knowledge of the system• Unit testing promotes flexible design• Better complexity management• Automating tests lead to fearless coding• Free regression coverage
  4. 4. Unit testing myths• “Testers test, developers develop”• “Its dull to write tests.”• “There’s no time to write tests.”• “We’ll write the unit tests later.”• “The code will change, so the tests will fail in the (near) future.”• “The test we wrote some time ago (probably) don’t work anymore.”
  5. 5. Unit testing myths• “Unit testing is weak at finding problems that haven’t been considered.”• “It takes too much time and effort to think of all possible cases and write all those tests.”• “Methods not being easily testable”• “Not feasible for big projects”• “Not feasible for existing projects”
  6. 6. Unit testing myths• “It saves money”• “It reduces the number of bugs”• “It brings a higher code quality”• “It improves performance”• “It’s easy to unit-test concurrency”
  7. 7. Fakes and Stubs and Mocks, oh my• Dummy Just a placeholder object, unused and unusable• Stub A placeholder implementation, returning defaults• Fake A working, albeit trivial implementation• Mock A simulated object that mimics behavior
  8. 8. How to unit test in .net• NUnit• MSTest• TestDriven• Moq• RhinoMocks• Typemock• Microsoft Fakes• …
  9. 9. DEMO
  10. 10. Is unit-testing TDD?• NO• Test-before development – red / green / refactor• Test-after development
  11. 11. DEMO
  12. 12. ?

×