This is an old revision of the document!
Table of Contents
SWAT checklist for testing
Code conventions
- Assigned modules per week will be validated against the PHP coding conventions available at http://www.sahana.lk/wiki/doku.php?id=dev:php_coding_convention.
- PHPCheckstyle(http://developer.spikesource.com/projects/phpcheckstyle) validation
Following tests will be done using PHPCheckstyle
- Test “noShortPhpCodeTag”: Tests and reports and error if a short php
code open tag is used.
- Test “noShellComments”: Tests and reports and error if there is a
shell/perl style comment (that starts with '#').
- Test “lineLength”: Tests for long lines and reports error if a
line exceeds the value of “maxLineLength” property. The default value of “maxLineLength” is 80.
- Test “docBlocks”: Tests that every function and class is
immediately preceded by a docblock. A property “excludePrivateMembers” can be set if you want to disable docblocks for private member functions.
- Test “controlStructNeedCurly”: Tests to make sure that every
control structure is included within a {} block, even if it is syntactically optional.
- Test “controlStructOpenCurly”: Tests for the location of the open
curly bracket for a control structure.
- Test “funcDefinitionOpenCurly”: This is similar to “controlStructOpenCurly” explained above. Except that this is for
function definition and the default value of “position” is new line (“nl”).
The other convention validations will be done manually.
PHPCheckstyle installation and generate test reports
- Download phpcheckstyle from http://developer.spikesource.com/projects/phpcheckstyle
- Unzip the content to a folder i.e:phpcheckstyle
- Uncomment the following lines in the pear.cfg.xml file in config directory
<test name="spaceAfterControlStmt"/> <test name="spaceAfterSemicolon"/> <test name="funcDefinitionOpenCurly"> <property name="position" value="nl"/> </test> <test name="whiteSpaceSurroundsOperators"/>
- Issue the following command from the checkstyle home directory to generate the test report
php run.php –src 'PATHTOINCFILE'
- Open the generated HTML file using Firefox
Module developer conventions
- Reusing libraries
- Folder structure
- File structure
- Adhering to front controller
Integration testing
- Identify module dependencies
- Validate the dependencies in the code