Actions

Difference between revisions of "Unit Tests Working Group"

From Joomla! Documentation

(Created page with "The Unit Tests for CMS Working Group is a Production Working Group. It is responsible for seeing that the Unit Tests for the CMS are created and maintained. ==Coordinators & PLT...")
 
(Updates)
(8 intermediate revisions by 2 users not shown)
Line 2: Line 2:
  
 
==Coordinators & PLT Contact==
 
==Coordinators & PLT Contact==
The coordinator for this working group is Michael Babker.
+
The PLT Contact for this working group is [mailto:michael.babker@joomla.org Michael Babker].
  
 
==Announcements==
 
==Announcements==
  
 
==External resources==
 
==External resources==
 +
 +
* [http://phpunit.de/manual/3.7/en/index.html PHPUnit 3.7 Manual]
 +
* [https://github.com/joomla/joomla-cms/tree/master/tests/unit Joomla CMS unit test suite] (note as of June 2013, the CMS has imported the Joomla Platform unit tests as well)
 +
* [http://developer.joomla.org/cms-coverage CMS Unit Test Coverage Report] (note that as of June 2013, this report covers the CMS and Platform (files found under /libraries/joomla and /libraries/legacy) due to the CMS reabsorbing responsibility for the Platform code)
  
 
==Deliverables==
 
==Deliverables==
Line 16: Line 20:
 
==Roadmap==
 
==Roadmap==
  
==Meetings==
+
Reaching the desired goal of 100% unit test coverage of CMS library classes can be broken down into three phases:
 +
 
 +
===Phase 1 - Review of current test structure (Complete)===
 +
 
 +
The initial phase of this "project" will be to review implemented tests and port tests to the Joomla Platform to improve test coverage as needed.  The current unit test suite has essentially been untouched since the formal split of the Joomla Platform (between the releases of CMS 1.6 and 1.7), and the test suite itself is designed to run on PHPUnit 3.4 (current version as of April 2012 is 3.6).  Rouven has a branch on his CMS repo which has removed all unimplemented test stubs, tests for removed methods, and tests that are already covered in the Platform.  The remaining tests are available at https://github.com/realityking/joomla-cms/tree/unittest/tests/unit/suite/libraries/joomla.
 +
 
 +
===Phase 2 - Develop unit test structure (Complete)===
 +
 
 +
Once the current structure has been combed through to ensure that any valid tests have been ported to the Joomla Platform, we will develop a new unit test framework for the CMS using current versions of all tools (i.e. PHPUnit).  The testing will be focused on the CMS 3.0 release series, and as such should be written using PHP 5.3.1 as the minimum supported version (note: the minimum PHP version is based on the current Platform requirements and the previously announced drop of PHP 5.2 support for CMS 3.0).  The Platform has a strong unit test infrastructure and can be used as a model for the CMS's framework.
 +
 
 +
Note that PHPUnit has internal support for database testing.  The Platform utilizes an in-memory SQLite database for general unit testing with additional test classes to test specific database driver functionality.  MySQL(i), PostgreSQL, and SQL Server are fully supported by PHPUnit.
 +
 
 +
===Phase 3 - Write and maintain tests (On-going)===
 +
 
 +
Phase 3 will be an ongoing phase as new commits will require that the unit tests pass as well as new code needing testing.  The primary focus will be on CMS specific library classes (those found in /libraries/cms and the FinderIndexer** classes).  The tests should be written in a way to ensure that all methods work as intended, prevent backwards compatibility from being broken (unless otherwise intended and announced), and other use cases as necessary (such as security issues).
 +
 
 +
In addition to writing unit tests, the test structure will need to remain up-to-date with external tools.  For example, test methods in PHPUnit that are deprecated in the current 3.7 release that have been removed from the in-development 3.8 release should be avoided to ease the transition to the new version.  In instances where backwards compatibility will be broken between PHPUnit releases, an announced transition period must be made to allow for the test structure to be updated and all downstream contributors to update their systems.
 +
 
  
 
[[Category:Documentation Working Group]]
 
[[Category:Documentation Working Group]]
 
[[Category:Working Groups]]
 
[[Category:Working Groups]]
 +
[[Category:Automated Testing]]

Revision as of 18:02, 3 June 2013

The Unit Tests for CMS Working Group is a Production Working Group. It is responsible for seeing that the Unit Tests for the CMS are created and maintained.

Contents

Coordinators & PLT Contact

The PLT Contact for this working group is Michael Babker.

Announcements

External resources

Deliverables

Technical Work produced by this group

Communications

Roadmap

Reaching the desired goal of 100% unit test coverage of CMS library classes can be broken down into three phases:

Phase 1 - Review of current test structure (Complete)

The initial phase of this "project" will be to review implemented tests and port tests to the Joomla Platform to improve test coverage as needed. The current unit test suite has essentially been untouched since the formal split of the Joomla Platform (between the releases of CMS 1.6 and 1.7), and the test suite itself is designed to run on PHPUnit 3.4 (current version as of April 2012 is 3.6). Rouven has a branch on his CMS repo which has removed all unimplemented test stubs, tests for removed methods, and tests that are already covered in the Platform. The remaining tests are available at https://github.com/realityking/joomla-cms/tree/unittest/tests/unit/suite/libraries/joomla.

Phase 2 - Develop unit test structure (Complete)

Once the current structure has been combed through to ensure that any valid tests have been ported to the Joomla Platform, we will develop a new unit test framework for the CMS using current versions of all tools (i.e. PHPUnit). The testing will be focused on the CMS 3.0 release series, and as such should be written using PHP 5.3.1 as the minimum supported version (note: the minimum PHP version is based on the current Platform requirements and the previously announced drop of PHP 5.2 support for CMS 3.0). The Platform has a strong unit test infrastructure and can be used as a model for the CMS's framework.

Note that PHPUnit has internal support for database testing. The Platform utilizes an in-memory SQLite database for general unit testing with additional test classes to test specific database driver functionality. MySQL(i), PostgreSQL, and SQL Server are fully supported by PHPUnit.

Phase 3 - Write and maintain tests (On-going)

Phase 3 will be an ongoing phase as new commits will require that the unit tests pass as well as new code needing testing. The primary focus will be on CMS specific library classes (those found in /libraries/cms and the FinderIndexer** classes). The tests should be written in a way to ensure that all methods work as intended, prevent backwards compatibility from being broken (unless otherwise intended and announced), and other use cases as necessary (such as security issues).

In addition to writing unit tests, the test structure will need to remain up-to-date with external tools. For example, test methods in PHPUnit that are deprecated in the current 3.7 release that have been removed from the in-development 3.8 release should be avoided to ease the transition to the new version. In instances where backwards compatibility will be broken between PHPUnit releases, an announced transition period must be made to allow for the test structure to be updated and all downstream contributors to update their systems.