10 June 2010
by Georgiana
-> Continuous Integration
—> build automation [write build script to get latest code version; run tools to detect problems; run unit tests & publish these results; package; deploy]
—> summary of the tools enumerated below can be found in this presentation: http://www.slideshare.net/sebastian_bergmann/continuous-integration-of-php-projects-4354597
-> static code analysis
—> LOC [= lines of code] metric
—> CLOC [= comment LOC]
—> NCLOC [= non-comment LOC]
—> ELOC [= executable LOC]
—> welcome to phploc [ http://github.com/sebastianbergmann/phploc ]
—> demo phploc directly on PHPUnit
-> code duplication
—> totally identical LOC
—> phptok some_file.php
—> phpcpd /path/to/your/project [ the copy/paste detector >:) ]
-> code complexity
—> cyclomatic complexity [count the # of branching points]
—> NPath complexity [count the # of possible execution paths]
-> phpcs
—> the code sniffer 
—> start here: http://github.com/sebastianbergmann/phpcs-sebastian
—> allows for defining own sniffs; demo sniff list
-> pdepend
—> static analysis of PHP code
—> helps identify parts of app. which should be refactored
-> build automation tools
—> ant, make, phing, rake
—> delve a bit into ant features
—> small ant config to pull from git, run phpunit, run some of the static code analysis tools in parallel
—> demo ant run for an existing project, and get a glimpse at the reports of the static code analysis tools output
-> continuous integration server options
—> phpUnderControl: customized CruiseControl
—> Hudson [Java-based, open-source]
—> Bamboo -> the Atlassian way of doing it, still Java-based
—> Arbit -> an alpha release, PHP-based solution
—> demo: http://ci.thephp.cc/
1 comment |
Categories: testing
|
Tags: PHPUnit, Sebastian Bergmann, testing
10 June 2010
by Georgiana
-> what is SW quality?
-> the BankAccount example
—> PHPUnit 3.4.12 is used for these examples
—> CLI run using phpunit BankAccountTest
—> phpunit –testdox BankAccountTest —> used for instance to present functionality summary before the actual coding
—> setUp()
—> Q&A —> use @expectedException annotation instead of the try/catch block inside the method body
—> Q&A —> use 1 test method for each test, not stuff everything in 1 method
—> PHPUnit 4 might use the traits feature of PHP, as opposed to the JUnit approach
-> organizing tests
—> tree structure, mirroring the actual code organization
—> using group annotation you can run only specific tests
—> phpunit –filter testFreezingAnObjectWorks Tests [ excludes a specific slow test ]
-> automated bugfixes project
—> write a test to repro the bug
—> use genetic programming to issue the patch that fixes the bug
-> SW testing pyramid /// Categories of (Unit) Tests
—> bottom level: unit tests
—> upper level: functional tests [this is not the functional testing w/ Selenium!] [it's testing blocks of functionality instead units] [do the interfaces between classes abide their contracts?]
—> top-level: End-to-End Test [these are the expensive ones ... running a full Selenium arrangement across all browsers took more than 24h]
-> minimalistic MVC implementation
—> used to demo unit testing for more than just the Model
—> assertAttributeEmpty() and assertAttributeContains() work with public / private / private class members
—> @depends is a simple way of declaring dependencies between tests
—> sample of refactoring so that there’s no need to assertAttribute*() for protected / private members
-> PHPUnit Best Practices
—> use an XML configuration file
—> look inside the cwd for a phpunit.xml [fallback to phpunit.xml.dist]
—> generate code coverage report, showing also dead code
—> new beta thingy: code coverage distribution report + class complexity
Comments Off |
Categories: testing
|
Tags: PHPUnit, Sebastian Bergmann, testing