Next page | Contents page |

Testing

I have not really said enough about testing. It is very important. During the development my usual technique is to only write or modify a few lines at a time and then run the HTML file in Firefox browser. I have the browser's development console (Ctrl+Shift+K) open at the bottom of the window so I can see if there are any error messages. Such messages tell me in which line of which file an error was detected. That line does not necessarily contain the error, it could have been something before that. Because I only make a few changes between runs this nearly always enables me to find and fix my mistakes.

The Netbeans IDE that I use does have the capability of step-by-step debugging. Some people like to use that all the time but I only use it as a last resort, very rarely.

We should really write a set of tests that can be run at any time to verify that the program works, and that it still works after any future modifications. Each of the source files should have a unit test in which objects are created and then every method of that type of object is run to check that it returns what it should return. In the HTML/JS case I make a copy of the main HTML file (index.html) and call it test.html. I write a script section in that which contains all of my unit tests and they are run by the onload event.

Next page | Contents page |