|
|||||||||
|
Testing in isolation from the serverThe server creates an environment in which the CGI script is executed. Wrapper programs or test harnesses can be written to simulate this environment and to execute the script in a controlled manner. Wrapper programs can simply be ad hoc shell or Perl scripts that set up all the environment variables defined in the CGI specification and call the CGI script to be tested. The wrapper program can be executed, and the output checked, manually. This may suffice for very simple scripts, but for anything more complicated or critical, a more sophisticated test harness may be required. A test harness which incorporates a system of wrapper programs can be devised, and can be used for regression testing. The expected outputs resulting from specific inputs could be defined, and each stored in a set of files. The wrapper programs might then fetch each set of inputs from a file, invoke the CGI script with those inputs, and compare the outputs from the script with the expected results. Regression testing simply means checking that software continues to function as expected, and that tests previously carried out continue to give the same result. Test systems exist that can be used to automate the process and report on the results. DejaGNU is one such test system, freely available.
Next: Testing with the Up: Testing dynamic documents Previous: Testing dynamic documents
Spinning the Web by Andrew Ford |
||||||
Copyright © 1996-2002 Ford & Mason Ltd |