From Joomla! Documentation
Revision as of 18:13, 7 June 2010 by Dextercowley
News and Updates
- 2009 07 27 Document created.
- 2010 05 24 Added Tips & Tricks section.
- 2010 05 28 Started content overhaul and integration of related docs for more logical flow.
- 2010 06 07 Removed the sections on Selenium IDE and merged those with Writing System Tests for Version 1.6.
System testing is an essential part of a good Quality Control program. For a good general discussion of system testing, visit the Wikipedia article.
System Testing in Joomla!
System testing in Joomla! uses an open-source program called Selenium. Selenium allows you to create a test script that can be run automatically. The test script actually runs Joomla! in a browser and does the same keystrokes and mouse clicks that a user would do. It can also test for conditions such as the value of text or the presence of HTML elements and report when a test fails or when there is an error in the program.
The benefits of system testing are:
- System tests help you test that the application is working correctly from the point of view of a user.
- System tests help clearly specify how the application should behave.
- System tests help you test that changes made to one part of the application haven't created a bug somewhere else.
- System tests can be run automatically (for example, each night) so that testing is done as the application is being developed.
System Testing versus Unit Testing
System Testing and Unit Testing are complementary test strategies. In Joomla!, Unit Testing is mainly used to test the framework classes (for example, the classes in libraries/joomla). Unit tests test that an individual method (also known as function) in a class does what it is supposed to do. For example, a unit test is used to test that the methods in the JString class work as expected. Unit testing provides confidence that the framework classes work as expected and allows you to refactor these classes (improve the code without changing the functionality) and still have confidence that they still work correctly.
System tests test that the application works correctly from the user point of view. For example, a system test can test something simple, for example, that you can create a new menu item for a single article and show the menu item on the site. Or a system test can test something more detailed, for example that the parameters for a module all work as expected.
Designing and creating system tests requires that you know how to use the application. It does not require that you understand how the program is written. Application knowledge is more important than programming knowledge, so system tests can be designed and written by people with less technical knowledge of PHP or the Joomla! framework.
Writing System Tests with Selenium
For detailed documentation on writing system tests, please see the article Writing System Tests for Version 1.6.