Testing
This is an important part in the development which many times is left apart (this is the case for part of the FCKeditor code... we'll be working to fix it).
Creating well written tests brings many benefits. It is the best way to be sure that changes in the code are not interfering in other parts of it. It also makes easy to test the code on different browsers, identifying precisely all points of failure.
Automated Tests
Pure code that accomplishes self containing tasks, not requiring user intervention, can be tested by automated systems. We have chosen the JsUnit framework (http://www.jsunit.net) to run these kinds of tests.
Automated tests are placed in the "_test/automated" directory. The following files and directories are placed there:
- default.html : this page loads the main testing page (also called "suite").
- tests : this directory contains all test pages.
- tests/suite.html : this is the main test page.
- _jsunit : this directory contains the distribution files of JsUnit.
Running Automated Tests
To run all tests in a row, it is enough to call the "default.html" page. It will load our "suite" page inside the JsUnit framework.
It is also possible to run single test pages separately. Theoretically, a test page has no value when called directly, but we introduced a mechanism which loads the page inside JsUnit when opening it. So, just open the desired test page and it will ready to run.
Please take a look in the available test pages and the JsUnit documentation for samples.
Manual Tests
Being FCKeditor a user interface software, many of its components are designed to provide visual representations and manage user actions. Those kinds of components can't be tested by automated systems and require user intervention. Specific test cases for each of these components should be created and should be found at the "_test/manual" directory.
Test Package Proposal
The _test directory under FCKeditor source tree will be isolated into an independent code package during 2.6 development.
Purpose
Test cases will be isolated into a separate package for the following reasons:
- To reduce unnecessary baggage from the FCKeditor package;
- To facilitate a more test oriented development methodology;
- To improve quality of software and reduce bugs by having regression tests always ready;
- To include tests cases from both design and bug tickets from the Trac site.
Test Package Structure
Initial implementation of the test package will include the following:
- $FCKTEST - the test package root
- $FCKTEST/runners - automatic testing frameworks
- $FCKTEST/runners/jsunit - JSUnit testing engine
- $FCKTEST/runners/selenium - Selenium testing engine
- $FCKTEST/fckeditor - FCKeditor test cases
- $FCKTEST/fckeditor/ds - design tests
- $FCKTEST/fckeditor/ds/unit - JSUnit based tests
- $FCKTEST/fckeditor/ds/visual - Selenium based tests
- $FCKTEST/fckeditor/ds/interactive - User interactive test cases
- $FCKTEST/fckeditor/ts - bug tracker ticket tests
- $FCKTEST/fckeditor/ds/visual - Selenium based tests
- $FCKTEST/fckeditor/ds/interactive - User interactive test cases
- $FCKTEST/fckeditor/config.php - Config file for the path to an FCKeditor installation
- $FCKTEST/fckeditor/index.php - Entry page to FCKeditor tests
- $FCKTEST/fckeditor/ds - design tests
- $FCKTEST/runners - automatic testing frameworks