Abstract

A system, method, and computer program product is provided for script processing. A new script language and script processing is used to significantly reduce the number of lines required for a script. A script includes a global script segment associated with a script data segment. The global script segment includes global directives (automatic directives and script repeating directives). The script data segment includes command records. Automatic directives are interpreted and repeatedly executed until script processing is complete. Automatic directives can be selectively activated and de-activated by a user. Script repeating directives repeat processing of the script data segment until the script repeating directive is satisfied. A command record includes an operation name field identifying a particular command and one or more operand fields. The operand fields can include single values, a range of values, or substitution codes. The script processor automatically repeats processing the script for each command record in the script data segment. The script processor further interprets the syntax of an operand to determine whether an operand is a single value, range of values, pointer, or substitution code. For a single value, the script processor executes the operation using the single value. For a ranges of values, the script processor repeatedly executes the operation for each value in said range of values. For a pointer to a table or other range of values, the script processor repeatedly executes the operation for each value in the table or range of values pointed to by the pointer. For a substitution code, the script processor repeatedly executes the operation using a corresponding substitution value (e.g. data, time, or sequence number).

Description

CROSS-REFERENCE TO RELATED APPLICATIONS

This patent application is related to the commonly-owned, co-pending U.S. utility patent application Ser. No. 08/641,460 titled "Method and Apparatus for Simulating Multi-Tasking", by John V. McLain, Jr., filed on May 1, 1996 and incorporated by reference herein; and to the commonly-owned, co-pending U.S. utility patent application Ser. No. 08/774,650, titled "System, Method and Computer Program Product for Digital Cross Connect Testing", by John V. McLain, Jr. et al., filed concurrently herewith and incorporated by reference herein.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention pertains to script languages and script processing.

2. Related Art Problem

Scripts are commonly used in database systems to generate various commands. In testing and computer simulation applications, for example, scripts represent test scenarios which can be run by a computer test tool. Scripts contain command records. To execute the script, a script processor interprets each command record in sequence.

Script processors support scripting languages by interpreting the commands in a script and executing corresponding operations. Scripting languages, such as, database languages, query languages, or other programming languages, utilize commands which support data management functions. In a typical database management system these functions include data definition, manipulation, and scrolling and formatting functions.

Accordingly, scripting languages, such as, Structured Query Language (SQL), have commands for defining a data structure (CREATE TABLE), manipulating data (SELECT, UPDATE), and scrolling and formatting (UP, DOWN, totaling). Go To and other script commands for jumping within a script have also been used.

In testing applications, a script includes command records defining a test scenario. Each command record includes a command name (such as SEND Cross-Connect) and operands (or values) to be operated on in carrying out the command. In this way, a command record identifies a "local" command within the script. A command record does not define "global" directives that operate on an entire script. A conventional script processor interprets a command record in a script and only performs the corresponding local command within the script.

To repeat the local command, a separate command record must be added to the script. Separate command records are required for each data value. Thus, scripts can get very long as each local command is repeated for each different value. GO TO and other conventional jumping commands can reduce the number of command records in a script. However, these jump statements are tied to specific lines in a script, making it difficult to create and edit scripts. For example, lengthy scripts with jump statements can be difficult to modify when a script syntax is changed in a new software release.

What is needed is a script processor that can automatically perform repetitive operations without requiring separate command records to repeat each operation. A script processor is needed that can automatically perform repetitive operations without requiring GO TO or other jump-type command records to be expressly drafted in a script. A script processor is needed which automatically handles ranges of data values, separate tables of data values, or data substitutions in a script language. Such a script processor and script language is especially needed in applications where numerous, repetitive commands are used, such as, functional testing, stress testing, and stability testing.

SUMMARY OF THE INVENTION

The present invention provides a script processing system, method, and computer program product that can automatically perform repetitive operations without requiring separate command records to repeat each operation. According to the present invention, a script processor automatically performs repetitive operations without requiring GO TO or other jump-type command records to be expressly drafted in a script. A script processor automatically handles ranges of data values, separate tables of data values, or data substitutions. A single command record can have a global script directive (automatic or script repeating) that identifies a global function to be performed during script processing. A single command record can reference ranges of data values, separate tables of data values, or data substitutions. Multiple command records directed to each value are not needed.

In one preferred embodiment of the present invention, a script includes a global script segment associated with a script data segment. The global script segment includes at least one global directive and the script data segment includes at least one command record. A script processor reads each global directive in the global script segment, fetches the associated script data segment, and processes the script data segment based on each global directive that is read.

Two types of global directives are used, automatic directives and script repeating directives. A script processor interprets and performs an automatic directive until script processing is complete. Automatic directives can be selectively activated and de-activated through a user-interface during script processing. A script processor interprets a script repeating directive and repeats processing of the entire script data segment until the script repeating directive is satisfied.

A script data segment has one or more command records. Each command record includes an operation name field identifying a particular command and one or more operand fields. The operand fields can include single values, a range of values, or substitution codes. The script processor automatically repeats processing the script for each command record in the script data segment.

For each command record, the script processor reads the operation name and at least one operand and executes the named operation using data identified by each operand. The script processor interprets the syntax of an operand to determine whether the operand is a single value, range of values, pointer, or substitution code. When a single value is determined to be in an operand field, the script processor executes the operation using the single value. When a ranges of values is determined to be in an operand field, the script processor repeatedly executes the operation for each value in said range of values.

When a pointer to a table (or other data structure having a range of values) is determined to be in an operand field, the script processor repeatedly executes the operation for each table entry (e.g. each value in a table column). If a table entry has a range of values, the script processor repeats the command record operation for each value in the range of values before proceeding to the next table entry.

When a substitution code is determined to be in an operand field of a command record, the script processor repeatedly executes the operation named by the command record using a substitution value (e.g. data, time, or sequence number) corresponding to the substitution code. Likewise, if a table entry has a substitution code, the script processor repeats the command record operation using a substitution value before proceeding to the next table entry.

In a testing application, the automatic directive can include, but is not limited to, a dynamic send directive and a dynamic receive directive. Dynamic send and dynamic receive directives can be selectively activated and de-activated through a user-interface during script processing. The repeating directive can include, but is not limited to, a repeat directive and a channel directive.

Further features and advantages of the present invention, as well as the structure and operation of various embodiments of the present invention, are described in detail below with reference to the following drawings.

BRIEF DESCRIPTION OF THE FIGURES

The accompanying drawings, which are incorporated herein and form part of the specification, illustrate the present invention and, together with the description, further serve to explain the principles of the invention and to enable a person skilled in the pertinent art make and use the invention.

FIG. 1 is a block diagram of a computer database management system for processing a script according to the present invention.

FIG. 2 is a schematic diagram of an example script according to the present invention.

FIG. 3 shows an example command template that can be used in a script according to the present invention.

FIGS. 4A and 4B are a flowchart of a script processing routine according to the present invention.

FIGS. 5A, 6A, and 7A each illustrate the number of command records needed in the present invention to send cross-connect commands for connecting a range of ports in an example DXC testing application. FIG. 5A shows an advantage of using a range in a script line according to the present invention. FIG. 6A shows an advantage of using a table in a script line according to the present invention. FIG. 7A shows an advantage of using a table in a script line, where the table has a column entry which is a range, according to the present invention.

FIGS. 5B, 6B, and 7B each illustrate the number of command records needed in existing technology to send cross-connect commands for connecting a range of ports in an example DXC testing application.

FIG. 8 is a block diagram of an example computer system for implementing a script processor according to the present invention.

The present invention will now be described with reference to the accompanying drawings. In the drawings, like reference numbers typically indicate identical or functionally similar elements. Additionally, the left-most digit(s) of a reference number typically identifies the drawing in which the reference number first appears.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

Script Processing

The present invention is described with respect to a computer database system environment. Description in these terms is provided for convenience only. It is not intended that the invention be limited to application in this example environment. In fact, after reading the following description, it will become apparent to a person skilled in the relevant art how to implement the invention in alternative environments.

According to the present invention, script processor 120 is included for processing one or more scripts 125. The operation of script processor 120 is described in detail with respect to script processing routine 400 in FIGS. 4A and 4B.

FIG. 2 is a schematic diagram of a script 200 according to the present invention. Script 200 includes a global script segment 210 and a script data segment 240. Global script segment 210 includes a description 220, one or more global directives 230, and a script data table pointer 235. Description 220 includes text describing script 200. Global directives 230 can be either automatic directives and/or script repeating directives.

Script data table pointer 235 points to script data segment 240. In this way, the global script segment 210 need not include script data segment 240 and can be easily changed to run against other script data segments by changing the script data table pointer 235. Alternatively, a script data segment can be included directly in script 200, as indicated by script data segment 240'.

Script data segment 240 consists of n command records, where n is a whole number 0 to n. Each command record (1 to n) has a operation name field and one or more operand fields. The operation name field defines the operation that is to be performed using the operand fields. Each operand field can have a single value, range of values, table column pointer, or substitution code. Any combination of operand fields can be included in a single command record as appropriate for a given operation command.

In the example script data segment 240, Record 1 includes single value and range operands. Record 2 shows two table columns C1 and C2 used in respective operand fields. Record 3 shows two types of substitution codes, a sequence code and a date code, used in respective operand fields. Record n shows a time substitution code used in an operand field.

FIG. 3 shows an example SEND command template 300 as used for DXC testing. The SEND command template (or record) has an operation name field that includes a value representing a SEND command name. Seven operand fields are included: Command, Command Format, Delay Interval, Message Type, Action, FieldN, Expected Response. Command identifies DXC ports to be cross-connected. Command has a syntax interpreted by the script processor 120 to identify whether the value therein is a single value, range of values, substitution code, or script data segment pointer. Command Format is an ASCII or Binary Indicator.

Delay Interval sets a Message Transmission Delay Interval for flow control. Message Type is a Response Length Indicator (i.e., Single Line, Delimited, Random). Action is provided for error checking and error handling. FieldN denotes a start offset to isolate an Expected Response. Expected Response is the expected response value. This type of SEND command record is described in further detail in the above DXC Test Tool application incorporated by reference herein.

FIGS. 4A and 4B are a flowchart of a script processing routine 400 carried out by script processor 120 to read, interpret, and execute scripts 125. For clarity, script processing routine will be described with reference to the example script 200. In step 410, script processor 120 fetches global script segment 210. If desired, description 220 can be read and output through a user-interface for display (not shown).

As shown in FIG. 4B, an automatic directive processing routine 450 is used to process automatic directives read in step 420. Script processor 120 interprets each automatic directive (step 452). In particular, script processor reads an operation name field identifying the particular automatic directive and any associated operand fields. In general, automatic directives can identify any operation to be performed by the script processor 120 or any application. For example, an automatic directive can include, but is not limited to, dynamic send and dynamic receive directives (DSEND, DRECEIVE) as described in the above DXC Test Tool application incorporated by reference herein.

A check is also made to determine whether an automatic directive is activated (step 454). If the automatic directive has been activated by a user or automatically set, the automatic directive operation is performed (step 456). In other words, script processor 120 interprets and executes the automatic directive (reads the directive operation name and performs a corresponding operation based on any associated operands). Script processor 120 repeats performing the automatic directive operation until processing of script 200 is complete (step 458) or no longer activated. The check in step 454 is an optional step that is provided to give a user control over processing of automatic directives, that is, to let a user turn them off.

Activation and deactivation is controlled through a user-interface (not shown) coupled to CPU 100. Any conventional user-interface can be used. For example, through a user-interface, script processor 120 can display a list of all automatic directives in a script and indicate whether each automatic directive has been activated or de-activated during script processing. A user can then selectively activate or de-activate individual automatic directives or groups of automatic directives through the user-interface during script processing. Note the automatic directive in a batch mode can be removed or controlled by conditional logic using separate command records or statement templates.

Script data segment processing routine 460 processes script repeating directives read in step 420 and the command records fetched in step 430. Script repeating directives have an operation name describing a script repeating operation and an operand specifying a corresponding script repeating condition at which point the script repeating operation is satisfied and ceased.

For example, a script repeating operation can identify that a script (at least script data segment 240) be repeatedly processed. The operand in the script repeating directive then specifies the number of times the script is to be repeatedly processed. A script repeating operation can also identify that a script (at least script data segment 240) be repeatedly processed using different substituted data values in each iteration. The operand in the script repeating directive then identifies the different data values to be substituted in each iteration. For example, a script repeating directive can include, but is not limited to, REPEAT and CHANNEL directives as described in the above DXC Test Tool application incorporated by reference herein.

Each script repeating directive is read and interpreted by script processor 120 (step 464). A script repeating condition is set (step 465). For example, a script repeating directive can have a condition number (e.g. 5) indicating the number of times that script processor 120 will repeat processing of script 200 (including script data segment 240).

Script processor 120 then reads and interprets a command record in script data segment 240 (step 466). A check is made on the syntax of each operand to identify whether the operand is a single value, range of values, table pointer, or substitution code (step 468).

For single value operands, script processor 120 executes an operation based on the single value (step 470). For a range of values or for a table of column entries, script processor 120 automatically executes the operation for each value in the range and for each column (or row) entry of the table pointed to by a table pointer (step 472). A range can also be included in a table column entry. Script processor 120 then executes the operation for each value in the range identified by the table column entry (step 472), before proceeding to read and process the next table column entry. For substitution codes, script processor 120 executes an operation based on a substituted value, e.g., date, time, or sequence number (step 473).

Routine 460 continues until no data records remain in script 200 (step 474) and the script repeating condition is satisfied (step 475). In other words, steps 466-474 are repeated for all n records until each script repeating directive is satisfied. Script processing is then terminated (step 480).

Routines 450 and 460 can be carried out by script processor 120 as soon as automatic and script repeating directives, respectively, are read in a script 200. Routines 450 and 460 can be performed substantially in parallel (through multi-tasking or simulated multi-tasking as described in the application incorporated by reference above) or in series.

Script processor 120 and routine 400 greatly reduce the number of records required in a script. FIGS. 5A, 6A, and 7A show the advantages of the present invention in reducing the number of lines in a script for generating multiple cross-connect and disconnect commands, compared to existing technology as shown in FIGS. 5B, 6B, and 7B, where one line is required for each send cross-connect and dis-connect command between two ports.

FIG. 5A shows that using ranges (e.g. port ranges 1-10 and 11-20 marked by a syntax "<- >") in a script line according to the present invention, means only one send command record 500 (or script line) is needed rather than ten individual SEND commands 550. Script processor 120 will automatically repeat sending SEND cross-connect commands covering each range value (i.e. 1 to 11, 2 to 12, . . . 10 to 20).

FIG. 6A shows that using script lines having pointers to a table 610 (e.g. columns C1 and C2) in a script line according to the present invention, means only one send cross-connect command record 600 is needed, rather than ten individual SEND cross-connect commands 650 (FIG. 6B). Likewise, only one send disconnect command record 602 is needed, rather than ten individual SEND disconnect commands 650 (FIG. 6B). When interpreting command records 600 and 602, and table 610, script processor 120 will automatically send SEND cross-connect commands and SEND disconnect commands repetitively for each table column entry value (i.e. 1 to 11, 2 to 12, . . . 10 to 20).

Script processor 120 and the script processing routine 400 can be implemented primarily in software, hardware, and/or firmware, and any combination thereof. For example, script processor 120 can include any conventional read unit, fetch unit, and interpreter for reading, fetching, interpreting, and executing scripts according to the present invention as described above.

FIG. 8 is a block diagram illustrating in more detail an example computer system 800 in which the present invention can operate. Computer system 800 includes one or more processors, such as processor 804. The processor 804 is connected to a communications bus 806.

Computer system 800 also includes a main memory 808, preferably random access memory (RAM), and can also include a secondary memory 810. The secondary memory 810 can include, for example, a hard disk drive 812 and/or a removable storage drive 814, representing a floppy disk drive, a magnetic tape drive, an optical disk drive, etc. The removable storage drive 814 reads from and/or writes to a removable storage unit 818 in a well known manner. Removable storage unit 818 represents a floppy disk, magnetic tape, optical disk, etc., which is read by and written to by removable storage drive 814. As will be appreciated, the removable storage unit 818 includes a computer usable storage medium having stored therein computer software and/or data.

In alternative embodiments, secondary memory 810 may include other similar means for allowing computer programs or other instructions to be loaded into computer system 800. Such means can include, for example, a removable storage unit 822 and an interface 820. Examples can include a program cartridge and cartridge interface (such as that found in video game devices), a removable memory chip (such as an EPROM, or PROM) and associated socket, and other removable storage units 822 and interfaces 820 which allow software and data to be transferred from the removable storage unit 822 to computer system 800.

Computer system 800 can also include a communications interface 824. Communications interface 824 allows software and data to be transferred between computer system 800 and external devices via communications path 826. Examples of communications interface 824 can include a modem, a network interface (such as Ethernet card), a communications port, etc. Software and data transferred via communications interface 824 are in the form of signals which can be electronic, electromagnetic, optical or other signals capable of being received by communications interface 824, via communications path 826. Note that communications interface 824 provides a means by which computer system 800 can interface to a network, such as, the Internet.

The present invention is described in terms of this example environment. Description in these terms is provided for convenience only. It is not intended that the invention be limited to application in this example environment. In fact, after reading the following description, it will become apparent to a person skilled in the relevant art how to implement the invention in alternative environments.

The present invention is preferably implemented using software running (that is, executing) in an environment similar to that described above. In this document, the term "computer program product" is used to generally refer to removable storage device 818 or a hard disk installed in hard disk drive 812. These computer program products are means for providing software to computer system 800.

Computer programs (also called computer control logic) are stored in main memory and/or secondary memory 810. Computer programs can also be received via communications interface 824. Such computer programs, when executed, enable the computer system 800 to perform the features of the present invention as discussed herein. In particular, the computer programs, when executed, enable the processor 804 to perform the features of the present invention. Accordingly, such computer programs represent controllers of the computer system 800.

In an embodiment where the invention is implemented using software, the software may be stored in a computer program product and loaded into computer system 800 using removable storage drive 814, hard drive 812 or communications interface 824. Alternatively, the computer program product may be downloaded to computer system 800 over communications path 826. The control logic (software), when executed by the processor 804, causes the processor 804 to perform the functions of the invention as described herein.

Various software embodiments are described in terms of this example computer system. After reading this description, it will be apparent to a person skilled in the relevant art how to implement the invention using other computer systems and/or computer architectures.

In another embodiment, the invention is implemented primarily in firmware and/or hardware using, for example, hardware components such as application specific integrated circuits (ASICs). Implementation of a hardware state machine so as to perform the functions described herein will be apparent to persons skilled in the relevant art(s).

Conclusion

While various embodiments of the present invention have been described above, it should be understood that they have been presented by way of example only, and not limitation. It will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined in the appended claims. Thus, the breadth and scope of the present invention should not be limited by any of the above-described exemplary embodiments, but should be defined only in accordance with the following claims and their equivalents.

Claims (27)

What is claimed is:

1. A method for processing a script, the script includes at least one global script segment associated with a script data segment, the global script segment includes at least one global directive and the script data segment includes at least one command record, the method comprising the steps of:

reading each global directive in the global script segment included in script;

fetching the associated script data segment which includes the command record; and

processing the script data segment based on each global directive read in said reading step.

2. The method of claim 1, wherein the at least one global directive can include at least one automatic directive; and said processing step comprises the steps of:

interpreting each automatic directive; and

performing each automatic directive until script processing is complete.

3. The method of claim 1, wherein the at least one global directive can include at least one script repeating directive; and said processing step comprises the steps of:

interpreting each script repeating directive; and

repeating processing of the script data segment until each script repeating directive is satisfied.

4. The method of claim 1, wherein the at least one global directive can include at least one of an automatic directive and a script repeating directive; and said processing step comprises the steps of:

interpreting each automatic directive;

interpreting each script repeating directive;

repeating processing of the script data segment until each interpreted script repeating directive is satisfied; and

reading an operation name identifying an operation and at least one operand identifying data operated upon by said operation;

determining when said operand contains a substitution code; and

executing said operation using a substitution value corresponding to said substitution code.

11. The method of claim 10, wherein said substitution code includes at least one of a data code, a time code, and a sequence code.

12. The method of claim 1, wherein the at least one global directive can include at least one automatic directive; and said processing step comprises the steps of:

interpreting and activating each automatic directive;

permitting a user to selectively de-activate each automatic directive; and

performing each activated automatic directive until script processing is complete.

13. A script processor for processing a script stored in a memory, the script includes at least one global script segment associated with a script data segment, the global script segment includes at least one global directive and the script data segment includes at least one command record, the script processor comprising:

a read unit reading each global directive in the global script segment included in the script;

a fetch unit fetching the associated script data segment which includes the command record; and

a processor processing the script data segment based on each global directive read by said read unit.

14. The system of claim 13, wherein the at least one global directive can include at least one of an automatic directive and a script repeating directive; and said processor further comprises:

an interpreter interpreting each automatic directive and each script repeating directive;

said interpreter repeats processing of the script data segment until each interpreted script repeating directive is satisfied, and performs each interpreted automatic directive until each repeated processing of the script data segment processing step is complete.

15. The method of claim 14, wherein, for each command record in the script data segment,

said interpreter reads an operation name identifying an operation and at least one operand identifying data operated upon by said operation, and

executes said operation using said data identified by said at least one operand.

16. The system of claim 14, wherein, for each command record in the script data segment,

said interpreter reads an operation name identifying an operation and at least one operand identifying data operated upon by said operation, determines when said operand contains a single value, and executes said operation using said single value.

17. The system of claim 14, wherein, for each command record in the script data segment,

said interpreter reads an operation name identifying an operation and at least one operand identifying data operated upon by said operation, determines when said operand contains a range of values, and executes said operation for each value in said range of values.

18. The system of claim 14, wherein, for each command record in the script data segment,

said interpreter reads an operation name identifying an operation and at least one operand identifying data operated upon by said operation, determines when said operand contains a pointer to range of values, and executes said operation for each value in said range of values pointed to by said pointer.

19. The system of claim 18, wherein said pointer points to a table having entries including said range of values.

20. The system of claim 14, wherein, for each command record in the script data segment,

said interpreter reads an operation name identifying an operation and at least one operand identifying data operated upon by said operation, determines when said operand contains a substitution code, and executes said operation using a substitution value corresponding to said substitution code.

21. The system of claim 20, wherein said substitution code includes at least one of a data code, a time code, and a sequence code.

22. The system of claim 13, wherein the at least one global directive can include at least one automatic directive; and said processor further comprises:

an interpreter that interprets and activates each automatic directive, wherein, said interpreter permits a user to selectively de-activate each automatic directive and performs each activated automatic directive until script processing is complete.

23. A script processor for processing a script, the script includes at least one global script segment associated with a script data segment, the global script segment includes at least one global directive and the script data segment includes at least one command record, the processor comprising:

means for reading each global directive in the global script segment included in the script;

means for fetching the associated script data segment which includes the command record; and

means for processing the script data segment based on each global directive read in said reading step.

24. A computer program product comprising a computer useable medium having computer program logic recorded thereon for enabling a processor in a computer system to process a script, the script includes at least one global script segment associated with a script data segment, the global script segment includes at least one global directive and the script data segment includes at least one command record, said computer program logic comprising:

means for enabling the processor to read each global directive in the global script segment included in the script;

means for enabling the processor to fetch the associated script data segment which includes the command record; and

means for enabling the processor to process the script data segment based on each global directive.

25. A method for processing a script, the script includes at least one global script segment associated with a script data segment, the global script segment includes at least one global directive and the script data segment includes at least one command record, the method comprising the steps of:

reading an operation name field identifying an operation to be performed during said processing step and at least one operand field identifying data operated upon by said operation field;

determining when said operand field contains a range of values; and

executing said operation for each value in said range of values.

26. A method for processing a script, the script includes at least one global script segment associated with a script data segment, the global script segment includes at least one global directive and the script data segment includes at least one command record, the method comprising the steps of:

reading the script data segment which includes the command record; and

reading an operation name identifying an operation field and at least one operand field identifying data operated upon by said operation field;

determining when said operand field contains a pointer to a range of values; and

executing said operation for each value in said range of values pointed to by said pointer.

27. A method for processing a script, the script includes at least one global script segment associated with a script data segment, the global script segment includes at least one global directive and the script data segment includes at least one command record, the method comprising the steps of:

reading the script data segment which includes the command record; and