PagerDuty Integration Development
What can PagerDuty do
Schedule Auto escalation policy Support with many component, provide API for custom
Integrated with IMP Use API Incident Schedule Service User Get/trigger/acknowledge/resolve Log Schedule Get on-call Service Get group User Get user
Design Request Response Action Entity Test Some like Facebook thrift Different directory ; different from MVC (models, controls, views) PHPUnit
Why Request\Response Separate Request and Response that can use any Http communicate library Action put them together Entity hide all the details beyond them, so that it can switch to other data source Raise exception so that caller can deal it outside the library Thrift Domain object size Common deal
Test Not clear what to do, always change. Need to ensure code runs well after every change Quick test between different PagerDuty account Integrated with automated tools like CI Test example PHPUnit official link/doc/function Github source Kinds of test: functional, unit, integration, ui TDD,BDD,CDD Test case level :low/high CI, SVN, Jenkins continuous integration Selenium Phantom Online test
How to do PHPUnit test phpunit –coverage --bootstrap Test/Bootstrap.php Test/PagerDuty/User/ Always use boot file : define root path, const, auto load, exception handle Should not include http test, should mock it Request, response don’t have outside resource Action dose
Code Coverage Report xdebug
Why still have problems
Tips Bootstrap Namespace Exception Unit test case Annotation Coverage test What’s a good OOP design? Why not use get(“action”)? No variable, must be const. Why exception? Do not have logger, handle in caller Auto generate test case for input/output, like mars Annotation / Reflection / Decorator Default Input Output/multiple data format Server Client Test