Unit Testing 101
Upcoming SlideShare
Loading in...5
×
 

Unit Testing 101

on

  • 10,739 views

Unit Testing 101 presented at ESRI Developer Summit, March 24th, 2009. This talk reviews the key concepts of unit testing, the technologies used by DTSAgile in out development projects.

Unit Testing 101 presented at ESRI Developer Summit, March 24th, 2009. This talk reviews the key concepts of unit testing, the technologies used by DTSAgile in out development projects.

Statistics

Views

Total Views
10,739
Views on SlideShare
10,197
Embed Views
542

Actions

Likes
21
Downloads
382
Comments
3

16 Embeds 542

http://www.dtsagile.com 249
http://blog.davebouwman.com 94
http://blog.davebouwman.net 78
http://dtsagile.com 33
https://pittstate.angellearning.com 32
http://www.slideshare.net 32
http://www.agenciamonolito.com.br 7
http://www.linkedin.com 6
http://www.arcexperts.net 2
http://www.linkedin-ei2.com 2
https://www.linkedin.com 2
http://localhost 1
http://sites.google.com 1
http://feeds2.feedburner.com 1
file:// 1
http://localhost:3000 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

13 of 3 Post a comment

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • Dear sir: I am a diploma holder in NIIT Shimoga at the year 1996 with micro soft office, excel, and power-point as main subjects. Long before i am familiar with C & Java programming Though self study courses. Now i am finding it difficult to follow Unit Testing 101 & Unit testing and Test automation. Can u help me.
    Awaiting for early reply.
    Thanks and regards.
    shukoor

    Send it to mohamedshukoor2000@gmail.com
    Are you sure you want to
    Your message goes here
    Processing…
  • Well done for such difficult subject manner.
    Are you sure you want to
    Your message goes here
    Processing…
  • one of the best presentation I've seen so far at the dev summit
    Great job. Thanks.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Unit Testing 101 Unit Testing 101 Presentation Transcript

    • You need some tests yo! Dave Bouwman // CTO // DTSAgile
    • the “big” ideas
    • prove code works
    • prove design works
    • catch regression
    • unit testing 101
    • Instantiate class under test… Call Method… Check Results… Call Method… Check Results…
    • good tests are… independent repeatable self-contained* professional
    • good tests are… focused
    • tools!
    • “unit testing on crack” Scott Hanselman www.hanselman.com
    • writing tests
    • simple methods with simple signatures mean simple tests
    • complex methods with complex signatures mean… complex tests
    • most ArcObjects applications fall in this category
    • for testing design we must
    • separation of concerns
    • a class has single purpose
    • stay inside its box
    • user interface (events + logic + data access)
    • private void ButtonOn_Click(){ //read values from controls //apply business logic //connect to database //update data //update interface }
    • user interface objects business objects data access objects
    • Private void ButtonOn_Click(){ //read values from controls //apply business logic //send changes to DAL //connect to database //update data //update interface }
    • n-tier architecture
    • user interface WPF/Silverlight objects business objects unit tests data access objects
    • design patterns yo
    • model view controller
    • ASP.NET MVC released!! http://asp.net/mvc
    • dependency management
    • dependencies
    • 1 created by the constructor
    • private IAccountRepository _accountRepository; private IFormsAuthentication _formsAuthentication; private ILogService _logger; public AccountController() { _accountRepository = new AccountRepository(_connectionString); _logger = new Logger(); _formsAuthentication = new FormsAuthentication(); }
    • what about testing
    • good tests are… independent repeatable self-contained* professional
    • “tight coupling” external dependencies in the tests
    • internal dependencies
    • and separate them
    • 2 pass dependencies into the constructor
    • dependency injection
    • private IAccountRepository _accountRepository; private IFormsAuthentication _formsAuthentication; private ILogService _logger; public AccountController(IAccountRepository accountRepository, IFormsAuthentication formsAuthentication, ILogService logger) { _accountRepository = accountRepository; _formsAuthentication = formsAuthentication; _logger = logger; }
    • pushed the problem up a level
    • inversion of control
    • I need an AccountController! configuration Global.asax.cs
    • Castle Windsor Spring.NET mvccontrib IoC StructureMap Unity http://mvccontrib.codeplex.com
    • back to unit testing…
    • isolated testing
    • & mock fakes stubs
    • code you wrote generated on-the-fly
    • fake objects
    • stub/mock objects
    • tools!
    • rhinomocks http://ayende.com/projects/rhino-mocks.aspx
    • ArcMap development
    • not our box
    • separate logic from wiring
    • emulate events fromArcMap
    • my code sinks…
    • in ArcMap Business IEditEvents Shim Logic ArcMap
    • under test Business Test Logic
    • test your code not ESRI’s
    • ArcEngine Applications
    • it’s our box
    • design matters.
    • ArcGIS Server
    • testing Web ADF…
    • custom services
    • COM Utilities SOC COM Utility WebService ArcGIS Server
    • Server Object Extensions SOC SOE WebService ArcGIS Server
    • testable classes IServerObjectExtension COM COM SOE Utility Utility (ArcObjects) (ArcObjects)
    • but i’m too cool for COM…
    • jsunit D.O.H. Unit Testing FlexUnit Silverlight Harness
    • 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
    • i’m in teh codez writin teztz!
    • and nao u can too!
    • http://blog.davebouwman.net dbouwman@dtsagile.com questions http://twitter.com/dbouwman http://slideshare.com/dbouwman