Unit Testing 101

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

2 comments

Comments 1 - 2 of 2 previous next Post a comment

  • + DonSmith61 Don Weatherbee 10 months ago
    Well done for such difficult subject manner.
  • + omarello Omar Marji 10 months ago
    one of the best presentation I’ve seen so far at the dev summit
    Great job. Thanks.
Post a comment
Embed Video
Edit your comment Cancel

17 Favorites

Unit Testing 101 - Presentation Transcript

  1. You need some tests yo! Dave Bouwman // CTO // DTSAgile
  2. the “big” ideas
  3. prove code works
  4. prove design works
  5. catch regression
  6. unit testing 101
  7. Instantiate class under test… Call Method… Check Results… Call Method… Check Results…
  8. good tests are… independent repeatable self-contained* professional
  9. good tests are… focused
  10. tools!
  11. “unit testing on crack” Scott Hanselman www.hanselman.com
  12. writing tests
  13. simple methods with simple signatures mean simple tests
  14. complex methods with complex signatures mean… complex tests
  15. most ArcObjects applications fall in this category
  16. for testing design we must
  17. separation of concerns
  18. a class has single purpose
  19. stay inside its box
  20. user interface (events + logic + data access)
  21. private void ButtonOn_Click(){ //read values from controls //apply business logic //connect to database //update data //update interface }
  22. user interface objects business objects data access objects
  23. Private void ButtonOn_Click(){ //read values from controls //apply business logic //send changes to DAL //connect to database //update data //update interface }
  24. n-tier architecture
  25. user interface WPF/Silverlight objects business objects unit tests data access objects
  26. design patterns yo
  27. model view controller
  28. ASP.NET MVC released!! http://asp.net/mvc
  29. dependency management
  30. dependencies
  31. 1 created by the constructor
  32. private IAccountRepository _accountRepository; private IFormsAuthentication _formsAuthentication; private ILogService _logger; public AccountController() { _accountRepository = new AccountRepository(_connectionString); _logger = new Logger(); _formsAuthentication = new FormsAuthentication(); }
  33. what about testing
  34. good tests are… independent repeatable self-contained* professional
  35. “tight coupling” external dependencies in the tests
  36. internal dependencies
  37. and separate them
  38. 2 pass dependencies into the constructor
  39. dependency injection
  40. private IAccountRepository _accountRepository; private IFormsAuthentication _formsAuthentication; private ILogService _logger; public AccountController(IAccountRepository accountRepository, IFormsAuthentication formsAuthentication, ILogService logger) { _accountRepository = accountRepository; _formsAuthentication = formsAuthentication; _logger = logger; }
  41. pushed the problem up a level
  42. inversion of control
  43. I need an AccountController! configuration Global.asax.cs
  44. Castle Windsor Spring.NET mvccontrib IoC StructureMap Unity http://mvccontrib.codeplex.com
  45. back to unit testing…
  46. isolated testing
  47. & mock fakes stubs
  48. code you wrote generated on-the-fly
  49. fake objects
  50. stub/mock objects
  51. tools!
  52. rhinomocks http://ayende.com/projects/rhino-mocks.aspx
  53. ArcMap development
  54. not our box
  55. separate logic from wiring
  56. emulate events fromArcMap
  57. my code sinks…
  58. in ArcMap Business IEditEvents Shim Logic ArcMap
  59. under test Business Test Logic
  60. test your code not ESRI’s
  61. ArcEngine Applications
  62. it’s our box
  63. design matters.
  64. ArcGIS Server
  65. testing Web ADF…
  66. custom services
  67. COM Utilities SOC COM Utility WebService ArcGIS Server
  68. Server Object Extensions SOC SOE WebService ArcGIS Server
  69. testable classes IServerObjectExtension COM COM SOE Utility Utility (ArcObjects) (ArcObjects)
  70. but i’m too cool for COM…
  71. jsunit D.O.H. Unit Testing FlexUnit Silverlight Harness
  72. http://mbunit.com http://testdriven.net resources http://ASP.NET/mvc http://mvccontrib.codeplex.com http://castleproject.org http://ayende.com/projects/rhino-mocks.aspx
  73. i’m in teh codez writin teztz!
  74. and nao u can too!
  75. http://blog.davebouwman.net dbouwman@dtsagile.com questions http://twitter.com/dbouwman http://slideshare.com/dbouwman

+ Dave BouwmanDave Bouwman, 10 months ago

custom

3636 views, 17 favs, 12 embeds more stats

Unit Testing 101 presented at ESRI Developer Summit more

More info about this presentation

© All Rights Reserved

  • Total Views 3636
    • 3306 on SlideShare
    • 330 from embeds
  • Comments 2
  • Favorites 17
  • Downloads 276
Most viewed embeds
  • 120 views on http://www.dtsagile.com
  • 78 views on http://blog.davebouwman.net
  • 67 views on http://blog.davebouwman.com
  • 28 views on https://pittstate.angellearning.com
  • 23 views on http://dtsagile.com

more

All embeds
  • 120 views on http://www.dtsagile.com
  • 78 views on http://blog.davebouwman.net
  • 67 views on http://blog.davebouwman.com
  • 28 views on https://pittstate.angellearning.com
  • 23 views on http://dtsagile.com
  • 7 views on http://www.agenciamonolito.com.br
  • 2 views on http://www.arcexperts.net
  • 1 views on http://localhost:3000
  • 1 views on http://sites.google.com
  • 1 views on http://feeds2.feedburner.com
  • 1 views on file://
  • 1 views on http://localhost

less

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

Cancel
File a copyright complaint
Having problems? Go to our helpdesk?

Categories