Unit Testing Back-end Framework and Process

Download Unit Testing Back-end Framework and Process

Post on 16-Jul-2015

1.408 views

Category:

Technology

5 download

Embed Size (px)

TRANSCRIPT

Slide 1

Unit Testing: Back-end Framework and ProcessAugust 20, 2009No accurate tracking for adding accounts in GA Free for a yearDeactivates if inactive for 30 days1

AgendaMotivationTesting FrameworkProcessLimitationsConclusion

2

MotivationReduce bug count and cost of fixing a bug once its been shippedAs the team grows we need a regression suite that protects against breaking existing functionalityGoal is to make unit testing fast, easy, and part of the development process without lengthening release time

3

Testing FrameworkMostly server side testingDoes not require a DB, we setup data conditions in memory at the start of the test suiteIsolate testing to each code layerStub Methodology: test one class and the rest of the classes it depends out get stubbed out Stub classes still inherit from interfaces, but its methods always return the same values or it might have a generic data structure used for storage.Mocks require steeper learning curve for learning APIs specific to a frameworkStubs resemble existing class hierarchy

4

ProcessTesting Flavors: TDD or testing all code at the end; neither works for Mints development process or speed, especially when juggling multiple projectsWhat works:Include unit testing in project time estimatesDesign all front and backend interactions and classes, then split the problem up into deliverablesCode one section e.g. creating, updating, deleting a monthly budget then write test cases, then move on to accrual budgets, and then move on to tangential components like alerts for budgets.This methodology keeps up with the pace of design changesDont have to constantly re-write test cases As the design changes you can incrementally change test cases and add more as needed

5

LimitationsHarder to be as rigorous when juggling multiple projects Does not catch issues between tiers, still requires integration testing e.g. DAO methods or DB issues wont be testedRace conditions between web tier and other tiers

6

ConclusionsOnce the suite is setup its easy to add test cases Just one approach open to exploring other optionsSuggestions for frameworks or methodologies to use?Next steps:Exploring file formats to store and reuse test data e.g. CastorRefactoring stubs to make them cleaner and usable by othersSearching format to describe data e.g. text or a flatfile that doesnt require ramp -up

7