Robot header files and library files (translation)

xiaoxiao2021-03-06  52

head File

The SQABASIC header contains a series of declarations, and the header file can be applied.

One. Declare all or global constants, variables, and user-defined types

two. Disclaimer Custom Sub, Procedures and Function

The statement in the header file can be applied to any module (script or class library file). Use the '$ include keyword, place where the module begins - for example:

'$ Include "global.sbh"

SQABASIC header file type

Sqabasic supports two header file types:

One. The header file is saved in the SQABASIC path. You can apply them in this project or other project without specifying any path information.

two. The engineering header file can be saved in the TMS_Script folder. Do not specify any path information to be processed in the same project.

Both Sqabasic headers have the same extension - .sbh

Library file

The library file contains one or more sub, procedure, and function that procedure calls from other files.

One. SQABASIC library file (extension is .SBL or .rec)

Note that .rec file can be used as a script file or library file, but .sbl can only be used as library files.

two. Dynamic connection library file (extension .dll)

Different summary of the table below the table below:

.sbl .rec .dll location SQABASIC path current engineering DataStore Datastore (Folder TMS_Script) TMS_Script / DLL Mannist or other location range in the SQABASIC path, all project files can be used to use all scripts to the same project Verification point does not support the support of the standard ROBOT verification point Support Custom Verification Point

Any.rec file can be used as a library file. Anyway, if a .rec file is used as a script (you can run directly from Robot or with a callscript command), he must have a main process.

Declaration in the SQABasic library file

If there is a custom process in the SQABASIC, you declare that the method of the class file also applies the declaration process.

The following example is in the SQABasic library file (MyLib.SBL) declares a custom process (mysub):

Declare Sub MySub Basiclib "MYLIB" (Arg1 AS String, Arg2 AS INTEGER)

One. Keyword Basiclib, indicating process mysub in a SQABASIC library file

two. The name "MYLIB" of the library file, there is no need to write extensions (.sbl or .rec)

Remarks: Basiclib keyword refers to the declaration of the .sbx library file (and the .dll library file relative), it does not require a statement with a .sbx extension.

Where to declare the SQABasic library file

Sqabasic library files can be declared at any location

One. In the script or other library file, only in the module

two. In the header file, the module with the channel

The library file contains the routines that do not need to be specified or the 'include header file

Declaration process file in the DLL file

If the DLL file is customized, the declaration process can also declare the DLL file.

The following is an example of a DLL file (MyDLL.DLL) declared the custom process (mysub):

Declare Sub MySub Lib "Mydll" (byval arg1 as string, byval arg2 as integer)

One. Declaration is added to the lib key, indicating that the declaration process is in the DLL file (relative to .sbl or .rec sqabasic library file). Library file name (MYDLL), the name specified with the library

three. Parameter declarations typically include keywords BYVAL (parameter declarations include any keyword)

If the compilation location is in the SQABAS32 path or in the library file (.dll) of the system path, you don't have to specify the path. If the library file is no longer sqabas32 or in the system path, you need to make a path, such as

Declare sub mysub lib "E: mydll" (byval arg1 as string, byval arg2 as integer)

Where to declare the DLL file

You can sound in any declaration DLL file:

1. Script or SQABASIC library file, the module of the process

2. Header file, any module specified header file

Sqabasic path

The SQABASIC path is where the Robot saves and finds the SBL library file and the header file, and the user can also be defined in Robot.

Once you specify a SQABASIC path in Robot, this path is fixed. Anyway, Robot automatically sets the SQABASIC path, when the following conditions are true:

i. Still not explicitly define sqabasic in robot

II. I have established new engineering and data warehouses in Rational Aministrator.

III. Open the most recently created engineering and data warehouse

When all conditions on the top are true, Robot automatically sets the SQABASIC path to the following locations in new projects and data warehouses:

[NewProject] [newDataStore] defaulttestscriptDataStortMs_scriptsqabas32

Set steps:

1) Point Tools-> General Options

2) Point preferences page

3) Enter the path in the SQABASIC path

Rational Test Early Version No Menu Options To set the SQABASIC Path - See SQA Common Directory Pieces

Guide to use header files and library files

It is recommended to use the library file method below:

a) Custom function or process should use the header file (.SBH) and library file (.sbl) with the same file name, such as DataFunctions.SBH and DataFunctions.SBL. This process and function define (specify a declaration header file) in the header file and define in the library file. See the example below

b) Separation header (see constant header file) is used to include constants, variables, and user-defined types for scripts or library file calls. The header file is attached to the same file name, and _x or the _c (addition is an early naming regulation). Note that the header containing constants and variables must be added before the declaration header file and the library file. (DataFunctions.SBH and DataFunctions.SBL), such as' include "Datefunctions_c.sbh". This is easy to maintain so.

c) Put the associated functions in the same library through classification or program, for example, put all the functions related to DataFunctions.SBH / SBL, or add all functions to a library developed by a specific program (such as Appname .SBH / SBL)

d) The function is the preferred mode of the subroutine in the library file, and the result of the dispute process is not related to the call script. The function should return a value, or appropriate, the data can be returned by a variable or array. In the example behind, the results returned by the function represent the results or fail. e) All licenses and subroutines in library files must have "annotations", including the purpose and use of this process:

· Purpose

· Call statement (similar function declaration)

· Parameter declaration

· return value

Example

· Possible errors

· Historical revision record

Please see the example below.

f) Note from the library file has reasonable explanation, and you can know the logic of the process by reading a comment.

g) If the development and maintenance of the Robot library file is a centralized manner, then you can join '$ include all library files to the global.sbh header file, which is useful for all headers. This can join the default script template. Alternatively, the tester can select or contain the required library files in each script.

Rational Robot Test Guide

Paul Downes (Paul_Downs@providian.com)

Carl nagle (carl.nagle@sas.com)

7 December 20, 2001

Example of header files and library files

(NB. This is just an example.)

___________________ declarations header: excel.sbh __________________

'######################################################## ###########################################

'# Excel Function Library V4.0 Library Header File

'# ============================

"

'# Description:

'# Contains Functions That Utilize Excel's COM Automation Interface To Use

'# spreadsheets. See Excel.sbl for library details.

"

'# Package:

'# Excel.sbh Library Header File

'# Excel.sbl Source Code and Documentation

'# Excel_x.sbh Library Include File

"

'# History:

'# Orig author: andy tinkham

'# Orig Date: 12-10-98

"

'# @L (mkbutler@russell.com) Andy Tinkham

"

'# Changes:

'# 00/00/00 Author change Details

"

'# Copyright:

'# This code is copyright 1998-2002 by Andy Tinkham .

'# Except where otherwise indeed. permission is given for use by the' # Rational Teamtest Community. Redistribution is allowed as long as no charge

'# is Made for this Code and All Authorship Credits Remain Intact.

'######################################################## ###########################################

'# Constants, Variables, DataTypes

转载请注明原文地址:https://www.9cbs.com/read-115698.html

New Post(0)