Programming with HTML Forms / Testing
A Note on Testing
Programming with HTML Forms
In the early stages of form design, it is useful to test the form without having to write the accompanying application. For instance, early form testing involves checking what default values are posted if the user immediately presses the submit button.
One possibility is to set the FORM ACTION to point to qgp (or a program like it), which echoes name=value pairs. An alternative is to set ACTION to:
This program does much the same thing as qgp. The drawbacks are longer network access time, and the inability to modify the application to test specific form features.
Testing is also a problem with form applications, since it is not possible to run their user interface (i.e. the input document running in a browser) inside a source-level debugger. In normal circumstances, if the application fails, the browser returns a cryptic message.
The easiest way to avoid this problem is to test a modified version of the application which reads name and value pairs from the keyboard. A fragment of code which illustrates this idea for qdir.c is shown below. It reads strings straight into the val fields of the entries array. Since the name fields are not used in this application, they are not assigned values.