Automated testing procedures

Code needs to be tested to discover bugs, and a part of this testing can be automated. This does not replace normal user testing, but it can help.

The advantage of writing automated tests is that they can be run every day, every hour even, to check wether the tests still work. This helps to discover bugs sooner. It is also very useful to prevent regression: a bug is fixed, the code is changed again, and the bug comes back. WIth an automated test this would be immediately discovered.
What can we automate?
We can automate a lot of things. Let's keep things simple, though, and see what we can automate with a minimum of effort. If we skip the user interface for now, we can focus testing of parts that do not themselves produce output: functions, modules, code libraries.
Example test 1
This is a very simple test: it uses the code libraries to write a value into the database, and then look it up again. If the result we get when retrieve the data matches the data we tried to store, the test is passed succesfully.
... todo: write test code ... $input_user_info[] = ... UserManager::add_new_user... $retrieved_user_info = Database::get_user_info_from_id($user_id); compare return true | false
PHPUnit
PHPUnit is a dedicated library that handles automated testing. It is developed as a set of classes that are "run" to test the some PHP code.
Selenium RC, Core and IDE
Selenium is a set of dedicated testing tools that notably allow for "in-browser" automated tools, by using a set of directives to follow links through a page.
Test cases
This section lists a series of tests that can have a value for error detection (after an install, after a migration, to check the general health of a campus, etc).
- Test that quiz questions' answers are not the same for all questions
- Test that no SQL error appears on any one page
External links
- http://en.wikipedia.org/wiki/Automated_testing
- http://en.wikipedia.org/wiki/Regression_testing
- http://en.wikipedia.org/wiki/Test-driven_development
- http://en.wikipedia.org/wiki/Extreme_Programming
- http://en.wikipedia.org/wiki/Category:Extreme_Programming
- http://en.wikipedia.org/wiki/Category:Software_development_process
- http://en.wikipedia.org/wiki/Category:Software_engineering
