Continuous Integration

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.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    3 Favorites & 1 Group

    Continuous Integration - Presentation Transcript

    1. Continuous Integration Sebastian Bergmann & Stefan Priebsch October 21st 2009
    2. This presentation is about tools that help you build better software.
    3. Tools solve problems. Problems you should think about before it is too late.
    4. When things go wrong in software projects, the team has to work overtime and cancel vacations.
    5. More often than not, deadlines and quality goals are missed nevertheless.
    6. You will ask yourself: ”Why did I not test this?”
    7. Unit Tests improve the confidence in your code as they detect problems as early as possible.
    8. The focus of this presentation is not PHPUnit.
    9. Lets focus on other tools and best practices.  phploc  phpcpd  phpcs  pdepend  ant  CruiseControl  phpUnderControl
    10. Software Metrics phploc sb@thinkpad php-object-freezer % phploc --count-tests . phploc 1.3.0 by Sebastian Bergmann. Directories: 10 Files: 30 Lines of Code (LOC): 4032 Cyclomatic Complexity / Lines of Code: 0.06 Executable Lines of Code (ELOC): 1218 Comment Lines of Code (CLOC): 2007 Non-Comment Lines of Code (NCLOC): 2025 Interfaces: 2 Classes: 19 Abstract: 1 (5.26%) Concrete: 18 (94.74%) Lines of Code / Number of Classes: 153 Methods: 51 Scope: Non-Static: 48 (94.12%) Static: 3 (5.88%) Visibility: Public: 35 (68.63%) Non-Public: 16 (31.37%) Lines of Code / Number of Methods: 57 Cyclomatic Complexity / Number of Methods: 2.41 Functions: 0 Constants: 1 Global constants: 0 Class constants: 1 Tests: Classes: 9 Methods: 76
    11. Software Metrics phpcpd sb@thinkpad ~ % phpcpd /usr/local/src/phpunit/trunk/PHPUnit phpcpd 1.2.0 by Sebastian Bergmann. Found 4 exact clones with 131 duplicated lines in 7 files: - Extensions/Database/DataSet/AbstractTable.php:156-190 Extensions/Database/DataSet/ReplacementTable.php:172-206 - Samples/BankAccountDB/BankAccountDBTest.php:84-128 Samples/BankAccountDB/BankAccountDBTestMySQL.php:84-128 - Tests/Extensions/Database/DataSet/XmlDataSetsTest.php:71-98 Tests/Extensions/Database/DataSet/YamlDataSetTest.php:70-97 - Tests/Extensions/Database/DataSet/XmlDataSetsTest.php:71-97 Tests/Extensions/Database/DataSet/CsvDataSetTest.php:70-96 0.21% duplicated lines out of 61720 total lines of code.
    12. Software Metrics phpcs  Static Analysis of PHP Code  Based on ext/tokenizer  ”Sniffs”  Coding Standard  Software Metrics  Bug Patterns  Performance Patterns  ...
    13. Software Metrics pdepend  Static Analysis of PHP Code  Software Metrics  Software Visualization  Helps to identify parts of an application that should be refactored
    14. QA Tools for PHP Overview http://phpqatools.org/
    15. Build Automation Automate {error­prone|recurring|tedious} tasks
    16. Build Automation Apache Ant  Java-based build tool  Kind of like make, without make's wrinkles  Build files are XML-based, calling out a target tree where various tasks get executed
    17. Build Automation Apache Ant <project name="php-object-freezer" default="build" basedir="."> <target name="clean"> <!-- Clean up --> <delete dir="build"/> <!-- Create build directories --> <mkdir dir="build/api"/> <mkdir dir="build/coverage"/> <mkdir dir="build/logs"/> <mkdir dir="build/pdepend"/> <!-- Generate dummy PMD logfile --> <echoxml file="build/logs/pmd.xml"> <pmd version="dummy"/> </echoxml> </target> <!-- Update checkout --> <target name="update"> <exec dir="${basedir}/source" executable="git"> <arg line="pull"/> </exec> </target>
    18. Build Automation Apache Ant <!-- Run unit tests and generate junit.xml and clover.xml --> <target name="phpunit"> <exec dir="${basedir}/source" executable="phpunit" failonerror="true"> <arg line="--log-junit ${basedir}/build/logs/junit.xml --coverage-clover ${basedir}/build/logs/clover.xml --coverage-html ${basedir}/build/coverage Tests" /> </exec> </target> <!-- Run pdepend, phpcpd, phpcs, and phpdoc in parallel --> <target name="parallelTasks"> <parallel> <antcall target="pdepend"/> <antcall target="phpcpd"/> <antcall target="phpcs"/> <antcall target="phpdoc"/> </parallel> </target> <!-- Generate pmd-cpd.xml --> <target name="phpcpd"> <exec dir="${basedir}/source" executable="phpcpd"> <arg line="--log-pmd ${basedir}/build/logs/pmd-cpd.xml Object" /> </exec> </target>
    19. Build Automation Apache Ant <!-- Generate jdepend.xml and software metrics charts --> <target name="pdepend"> <exec dir="${basedir}" executable="pdepend"> <arg line="--jdepend-xml=${basedir}/build/logs/jdepend.xml --jdepend-chart=${basedir}/build/pdepend/08-dependencies.svg --overview-pyramid=${basedir}/build/pdepend/09-overview.svg source/Object" /> </exec> </target> <!-- Generate checkstyle.xml --> <target name="phpcs"> <exec dir="${basedir}" executable="phpcs"> <arg line="--report=checkstyle --report-file=${basedir}/build/logs/checkstyle.xml --standard=Sebastian source/Object" /> </exec> </target>
    20. Build Automation Apache Ant <!-- Generate API documentation --> <target name="phpdoc"> <exec dir="${basedir}/source/Object" executable="phpdoc"> <arg line="-q -ct type -ue on -tb /usr/share/pear/data/phpUnderControl/data/phpdoc -o HTML:Phpuc:phpuc -t ${basedir}/build/api -d ." /> </exec> </target> <target name="build" depends="clean,update,parallelTasks,phpunit"/> </project>
    21. Build Automation Apache Ant sb@thinkpad php-object-freezer % ant Buildfile: build.xml clean: [delete] Deleting directory /usr/local/cruisecontrol/projects/php-object-freezer/build [mkdir] Created dir: /usr/local/cruisecontrol/projects/php-object-freezer/build/api [mkdir] Created dir: /usr/local/cruisecontrol/projects/php-object-freezer/build/coverage [mkdir] Created dir: /usr/local/cruisecontrol/projects/php-object-freezer/build/logs [mkdir] Created dir: /usr/local/cruisecontrol/projects/php-object-freezer/build/pdepend update: [exec] Already up-to-date. pdepend: [exec] PHP_Depend 0.9.7 by Manuel Pichler [exec] [exec] Parsing source files: [exec] .......... 10 [exec] [exec] Executing Inheritance-Analyzer: [exec] 16 [exec] [exec] Executing NodeCount-Analyzer: [exec] .. 51 [exec] [exec] Executing Coupling-Analyzer: [exec] ... 76 [exec] [exec] Executing Dependency-Analyzer: [exec] .. 58 [exec] [exec] Executing NodeLoc-Analyzer: [exec] ... 61 [exec] [exec] Executing CyclomaticComplexity-Analyzer: [exec] ... 70 [exec] [exec] Generating pdepend log files, this may take a moment. [exec] [exec] Time: 00:01; Memory: 10.00Mb phpcpd: [exec] phpcpd 1.2.0 by Sebastian Bergmann. [exec] [exec] 0.00% duplicated lines out of 1686 total lines of code. phpcs: [exec] Result: 1 phpdoc: phpunit: [exec] PHPUnit 3.4.1 by Sebastian Bergmann. [exec] [exec] ............................................................ 60 / 78 [exec] .................. [exec] [exec] Time: 3 seconds [exec] [exec] OK (78 tests, 166 assertions) [exec] [exec] Writing code coverage data to XML file, this may take a moment. [exec] [exec] Generating code coverage report, this may take a moment. build: BUILD SUCCESSFUL Total time: 9 seconds
    22. Continuous Integration Feel the pulse of your project!
    23. Continuous Integration Software development practice where members of a team integrate their work frequently  Usually each person integrates at least daily, leading to multiple integrations per day  Each integration is verified by an automated build (including test) to detect integration errors as quickly as possible  Leads to significantly reduced integration problems and allows a team to develop cohesive software more rapidly
    24. Continuous Integration CruiseControl Framework for a continuous build process  Includes, but is not limited to, plugins for email notification, Apache Ant, Phing, and various source control tools  A web interface is provided to view the details of the current and previous builds
    25. Continuous Integration phpUnderControl Customization of CruiseControl that caters to the needs of PHP projects  PHPUnit  PHPDocumentor  PHP_CodeSniffer  (PHP_Depend)  (phpmd)  (phpcpd)
    26. Show Me A Demo!
    27. The End Thank you for your interest! These slides will be posted on http://slideshare.net/sebastian_bergmann We are writing a book on Quality Assurance in PHP Projects http://phpqabook.com/
    28. License   This presentation material is published under the Attribution-Share Alike 3.0 Unported license.   You are free: ✔ to Share – to copy, distribute and transmit the work. ✔ to Remix – to adapt the work.   Under the following conditions: ● Attribution. You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). ● Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under the same, similar or a compatible license.   For any reuse or distribution, you must make clear to others the license terms of this work.   Any of the above conditions can be waived if you get permission from the copyright holder.   Nothing in this license impairs or restricts the author's moral rights.

    + Sebastian BergmannSebastian Bergmann, 1 month ago

    custom

    630 views, 3 favs, 0 embeds more stats

    More info about this document

    CC Attribution-ShareAlike LicenseCC Attribution-ShareAlike License

    Go to text version

    • Total Views 630
      • 630 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 3
    • Downloads 51
    Most viewed embeds

    more

    All embeds

    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

    Groups / Events