Testing server behaviors
The Macromedia Exchange recommends performing the following tests on each server behavior you create:
- Apply the behavior from the Server Behaviors panel. If it has a dialog box, enter valid data in each field and click OK. Verify that no error occurs when the behavior is applied. Verify that the runtime code for the server behavior appears in the Code inspector.
- Apply the server behavior again and enter invalid data in each field of the dialog box. Try leaving the field blank, using large or negative numbers, using invalid characters (such as /, ?, :, *, and so on), and using letters in numeric fields. You can write form validation routines to handle invalid data (validation routines involve hand-coding, which is beyond the scope of this book).
After successfully applying your server behavior to the page, verify the following:
- Check the Server Behaviors panel to make sure the name of the server behavior appears in the list of behaviors added to the page.
- If applicable, verify that server-side script icons show up on the page. The generic server-side script icons are gold shields. To see the icons, enable Invisible Elements (View > Visual Aids > Invisible Elements).
- In Code view, (View > Code) verify that no invalid code is generated.
In addition, if your server behavior inserts code in the document establishing a connection to a database, create a test database to test the code inserted in the document. Verify the connection by defining queries that produce different sets of data, and different sizes of data sets.
Finally, upload the page to the server and open it in a browser. View the pages HTML source code and verify that no invalid HTML has been generated by the server-side scripts.