1 / 23

common development and testing tools

common development and testing tools. Jon Daniel Colin Dean 7 October, 2009. "Programming is managing forgetfulness.". Paul Oehler CTO of InterWorx, LLC. tools every programmer should use. Version Control Code Sniffing Code Testing Unit Testing Functional Testing Acceptance Testing

yen
Télécharger la présentation

common development and testing tools

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. common development and testing tools Jon DanielColin Dean 7 October, 2009

  2. "Programming is managing forgetfulness." Paul Oehler CTO of InterWorx, LLC

  3. tools every programmer should use • Version Control • Code Sniffing • Code Testing • Unit Testing • Functional Testing • Acceptance Testing • Regression Testing • Interface (UI) Testing • Continuous Integration

  4. version control • Used to store "snapshots" of your codebase • Allow you to create different "branches" of code • Makes merging and identifying changes easy • Helps manage forgetfulness • Can be either centralized or distributed (or a hybrid) • Many different open source packages available

  5. popular version control systems • Open Source • CVS (Concurrent Versions System) • Subversion • Git • Bazaar • SVK • DARCS • Mercurial (hg) • Commercial • BitKeeper • Perforce • MS Visual SourceSafe Centralized VCS Distributed VCS

  6. Central management One repository Simpler tools Smaller workflow Single point of failure Ask Jon aboutrm trunk Revision history is gold Older systems integrated Branches for version work Tags for releases Many copies of history Larger local repo All history can be local Commit then push Can be centralized Bazaar does this (LP) Git kinda does this Every bug fix is a branch Branches for versions Branches for releases centralized versus distributed http://en.wikipedia.org/wiki/Distributed_revision_control http://en.wikipedia.org/wiki/Comparison_of_revision_control_software

  7. PHP_CodeSniffer • Works with CSS, JavaScript, and PHP files • Is used to detect coding style violations • Can be configured to meet your needs • Includes templates for coding standards such as Zend and PEAR • Can be used in conjunction with version control

  8. JSLint • Developed by Douglas Crockford • Author of many JavaScript books you know and love • Finds common problems in JavaScript code • Yells at you when it thinks you do something stupid

  9. Write functionality as tests One test per method Or method set Write code to pass test Try not to modify test New code = new test test-driven development Widget create() destroy() render() airspeedVelocity() Widget_Test test_create() test_destroy() test_render() test_airspeedVelocity()

  10. Software Testing It's not the the QA department's job!

  11. unit testing • Unit = smallest testable section of code • do_something_small() NOT do_everything() • One test to one class • Class should generally be a model in MVC paradigm • Not a militant restriction • Failed test pinpoints problem code • Setup/teardown • Stubs, mockups, fakes • Modular testing • Tests NEVER rely on another test for anything • Living documentation • Code examples http://en.wikipedia.org/wiki/Unit_testing

  12. functional testing • "Does this action cause a desired state?" • Glue stage between Unit and Acceptance testing • Tests larger units than Unit tests • More opaque than Acceptance tests • Tests unit interaction • Controller tests in MVC • Controller+View tests in loose MVC • Tests multiple units simultaneously • Not always run continuously • May require more resources • This is but a small hurdle--jump it and move on

  13. acceptance testing • Also known as "Black Box" testing • Given certain inputs, certain outputs are received • Does not look at the inner workings of the module • Concerned with high level application testing • Generally "shallow and wide" • Touching all areas is most important http://en.wikipedia.org/wiki/Acceptance_testing

  14. regression testing • Detects regression • Reappearances of bugs • Decreased performance • Identifies faults before QA • One regression test per bug Excellent example: Automated tests when compiling PHP ""regression testing"? What's that? If it compiles, it is good, if itboots up it is perfect." - LBT http://en.wikipedia.org/wiki/Regression_testing

  15. continuous integration • Practices to decrease development and integration times • Use source control • Automate the build • Builds should automatically test themselves • Commit often and test every build • Keep the build fast • Test in a clone of production environment • Alert developers of build results http://en.wikipedia.org/wiki/Continuous_Integration

  16. automate the build • Going from source to application should be simple and easy • Less relevant in PHP, but used for tasks such as • copying code from source to testing • reverting databases to original state • updating config files • setting/fixing file permissions • running quick tests to ensure basic functionality

  17. commit often and test every build • Never go more than a few days without a commit • Every commit to trunk (or quick set of commits) gets built • Branches should be tested, but this is less important • Never ignore a failing build

  18. everyone gets builds results • All developers should be given e-mails of build results • Developers will know quickly if their code has issues • Alert the developer if a commit of theirs has broken the build • You can alert all developers if you are evil

  19. continuous integration tools • Many tools are available • CruiseControl with PHPUnderControl is common • Provide automated building as well as other statistics • Build times • Manage types of builds (full, UI, quick, "on-the-fly") • Percentage of successfully builds • Test coverage

  20. interface (ui) testing • In web development, generally a tool that runs tests through a number of web browsers • Ensures that interactions remain constant and the correct information is displayed • A useful method of "black box" testing

  21. selenium remote control • Useful for testing AJAX operations in your application • Works with Firefox, Safari, Opera, and IE • Includes a Firefox Addon to record macros and generate the corresponding code • Includes libraries for Java, Perl, PHP, Python, Ruby, .NET • Can use Selenium Grid to "cluster" your tests among many Operating Systems and browsers

  22. getting started with unit-testing • Starting with 0 tests can be scary • Write simple acceptance tests • Write a test for every new feature • Test parts of the code you are sure work • Test parts of code that are used the most • Automate testing from day 1 • Strive to have 1% coverage on all classes to start • Change practices to include test-driven development • Test security related areas • Look into test scaffolding scripts • Automatically construct and destruct classes

  23. The End!

More Related