cgitest
PROCEDURE
,
OPTION
,
VALUE

The cgitest statement tests a CGI procedure.


Parameters

This statement has three parameters:

procedure – name of the procedure to test.

option – additional option name (see text below).

value – additional option value (see text below).


Description

This statement tests a CGI procedure. In its most basic form, you simply specify the name of a procedure in the current database.

cgitest "displaysummary"

When this code runs, Panorama will generate the URL for this procedure, send the URL to the server, then display the result in a test window. If the current database is named accounts, this will produce a URL like this:

http://www.acme.org/cgi-bin/panoramax.cgi?accounts/displaysummary

Operation of this test window is described in URL Tool Menu (Web Debugging), see The URL Test Window on that page.

The test can be customized with one or more options. Each option is specified as a pair of parameters - the option name followed by the value. The available options are query, post, database, host, separator and cgipath. Note: The examples below only use one option at a time, but you can use multiple options together in any combination you need.

QUERY

The URL can also include additional parameters that the CGI procedure can examine to modify it’s behavior. To add additional text to the end of the URL, use the QUERY option, like this:

cgitest "find","QUERY","Mark Paddington"

If the current database is accounts, this will produce a URL like this:

http://www.acme.org/cgi-bin/panoramax.cgi?accounts/find/Mark%20Paddington

Note: This example used QUERY (all upper case) as the option name, but it can also be lower case (query, Query, or any other combination of upper and lower case.

POST

Some procedures are designed to process data from a web form. A web form may contain one or more data items (for obscure technical reasons these are also called POST data items). The cgitest statement allows you to test this type of procedure without an actual form. Instead, you use one or more post values to tell Panorama what form data items you want to simulate. It’s much simpler and faster to test the procedure directly this way rather than having to go thru the hassle of bring up and filling in a form page every time you want to test.

Here’s an example for testing a newperson procedure that uses five web form items to add a new record to the database on the server.

cgitest "newperson",
    "POST","First=Susan",
    "POST","Last=Evans",
    "POST","Address=384 Marsh Road",
    "POST","City=Providence",
    "POST","State=NM"

DATABASE

If not specified, the procedure you specify must be in the currently active database. However, by adding the DATABASE option you can specify any open database, like this:

cgitest "displaysummary","DATABASE","Portfolio"

This will generate a URL like this:

http://www.acme.org/cgi-bin/panoramax.cgi?Portfolio/displaysummary

HOST

The URL domain is usually generated automatically based on the sharing configuration of the database. Sometimes, however, you’ll want to test with a different domain. For example, suppose you have set up Apache on your local computer, and you want to test your web procedures using Apache. To do that, you’ll need to use http://localhost as the domain, instead of the normal domain for that database. To do that, add a host option to the

cgitest "displaysummary","HOST","http://localhost"

This will generate a URL like this:

http://localhost/cgi-bin/panoramax.cgi?accounts/displaysummary

SEPARATOR

Panorama normally uses a slash (/) in the URL between the database, procedure names, and extra parameters. However, earlier versions used the ~ character instead. If you wish to use the ~ character, specify that with the SEPARATOR option.

cgitest "displaysummary","SEPARATOR","~"

This will generate a URL like this:

http://www.acme.org/cgi-bin/panoramax.cgi?account~displaysummary

CGIPATH

To change the path to the Panorama CGI, use the CGIPATH statement.

cgitest "displaysummary","CGIPATH","cgi-bin/my.cgi"

This will generate a URL like this:

http://www.acme.org/cgi-bin/my.cgi?account~displaysummary

This only changes the path as far as the test goes. It’s up to you to configure your server so that the path you specify works. If this doesn’t make any sense to. you, just leave the default path of cgi-bin/panoramax.cgi in place.

LOG

If the LOG option is set to YES or true, Panorama will automatically download the server instrumentation log after the CGI procedure runs.

cgitest "displaysummary","LOG","YES"

The log will also automatically download if the Auto Download after Each Test option is enabled in the URL Tool Menu. See URL Tool Menu (Web Debugging) to learn more about using instrumentation with CGI server procedures.


See Also


History

VersionStatusNotes
10.2NewNew in this version.