⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 commands.script

📁 Software Testing Automation Framework (STAF)的开发代码
💻 SCRIPT
📖 第 1 页 / 共 2 页
字号:
.***************************************************************************.* Software Testing Automation Framework (STAF).* (C) Copyright IBM Corp. 2001, 2004.*.* This software is licensed under the Common Public License (CPL) V1.0. .****************************************************************************.*************************-START-OF-PROLOG-****************************.*.*  File Name          : Commands SCRIPT.*  Descriptive Name   : Software Test Automation Framework Commands.*  Detail:.*.*     This file contains a description of the STAF Commands..*.**************************-END-OF-PROLOG-*****************************:i1.STAFProc command:ih1.commands:i2.STAFProc:h1 id=commands.Commands:h2 id=stproc.STAFProc:p.STAFProc is what starts STAF running on a machine.:h4.Syntax:xmp.STAFProc &lbrk.STAF Configuration File&rbrk.:exmp.:h4.Examples:xmp.STAFProc d:\staf\bin\mystaf.cfg:exmp.:p.If :xph.&lbrk.STAF Configuration File&rbrk.:exph. is not specified, STAFProcwill try to use the file staf.cfg.  It will search for this file in the currentdirectory, as well as the directory in which STAFProc resides.:note text=Warning.In order to stop the STAFProc daemon process, you shouldenter the command ":xph.STAF local shutdown shutdown:exph." (or use theassociated program in your "Start" menu on Windows systems).  Pressing CTRL-C (orissuing a "kill" command) will terminate STAFProc, but will not allow itto properly cleanup, which may cause problems and/or delays when tryingto restart STAFProc.  See section :hdref refid=shutds. for more informationon the SHUTDOWN service.:enote.:note.Any changes made to the STAF Configuration File after STAFProc has been startedwill not take effect until you shutdown and restart STAFProc.:enote.:h3 id=multipleinstances.Running Multiple Instances of STAFProc:p.Multiple instances of STAFProc can be run at the same time on thesame system .  This makes it possible to use STAF to install/upgrade STAF itself.To run multiple instances of STAF, system-specific resources need to bedifferentiated.  There is a special environment variable, STAF_INSTANCE_NAME,that can be used to specify a name for each STAFProc instance to differentiatebetween multiple instances of STAF.  If this environment variable is not set, thedefault value, "STAF", is used for the instance name.If the STAF_INSTANCE_NAME environment variable is not set to a unique valueprior to starting a new instance of STAFProc, you will see a"STAFProc already started" error.:p.For each instance of STAFProc running on a system, the following settings must be unique::ul.:li.Ports used by TCP Connection Providers::p.The ports used by STAF TCP connection providers must be unique,otherwise, you'll get a "Error starting tcp interface" error when starting STAFProc.If one instance of STAF is running using a tcp interface with default port 6500,then to start another instance of STAF that also uses a tcp interface, you mustspecify a different port in its STAF configuration file.  For example::xmp.interface tcp library STAFTCP option port=6501:exmp.:li.Data directory::p.Each STAFProc instance must use a different data directory.However, since the default setting for the data directoryis {STAF/Config/STAFRoot}/data/{STAF/Config/InstanceName}, the datadirectory names will be different if they are not overridden usingthe DATADIR operational setting (and as long as the STAF_INSTANCE_NAMEenvironment variable is set to a unique value).If the data directory for a STAFProc instance is not unique, you'll get a"Data directory is already in use" error when starting STAFProc:eul.:p.The installer creates a STAFEnv script file in the root STAF installlocation that can be used to set the required environment variablesfor a version of STAF.  On Windows, the script file is calledSTAFEnv.bat and on Unix, the script file is called STAFEnv.sh.The STAFEnv script files are especially useful if you are going to berunning two versions of STAF on the same machine and need a convenientway to switch settings for each version of STAF.An optional argument specifying the STAF instance name can be passedto a STAFEnv script file.A similar STAFEnv script file will also be created for setting up theenvironment for STAF V2, if STAF V2 is installed on the same machineas STAF V3.:p.Here's a sample STAFEnv.bat file for Windows: :xmp.@echo offREM STAF environment variables for 3.0.2set PATH=C:\STAF\bin;%PATH%set CLASSPATH=C:\STAF\bin\JSTAF.jar;C:\STAF\samples\demo\STAFDemo.jar;%CLASSPATH%set STAFCONVDIR=C:\STAF\codepageif "%1" EQU "" set STAF_INSTANCE_NAME=STAFif "%1" NEQ "" set STAF_INSTANCE_NAME=%1:exmp.:p.Here's a sample STAFEnv.sh file for Linux: :xmp.#!/bin/sh# STAF environment variables for 3.0.2PATH=/usr/local/staf/bin&colon.$PATHLD_LIBRARY_PATH=/usr/local/staf/lib&colon.$LD_LIBRARY_PATHCLASSPATH=/usr/local/staf/lib/JSTAF.jar&colon./usr/local/staf/samples/demo/STAFDemo.jar&colon.$CLASSPATHSTAFCONVDIR=/usr/local/staf/codepageif [ $# = 0 ]then    STAF_INSTANCE_NAME=STAFelse    STAF_INSTANCE_NAME=$1fiexport PATH LD_LIBRARY_PATH CLASSPATH STAFCONVDIR STAF_INSTANCE_NAME:exmp.:p.The sample scripts that are created automatically by STAF will usethe actual install directories in the STAFEnv script files.:p.Here's an example of starting STAF V2 and STAF V3 on a Windows system,where STAF V2 is installed in C:\STAF and STAF V3 is installed inC:\STAF3.  The STAF configuration file used by each STAFProcinstance specify different port numbers for each TCP Connection Provider.:xmp.  C:  cd \STAF  STAFEnv.bat  STAFProc:exmp.In another command prompt::xmp.  C:  cd \STAF3  STAFEnv.bat  STAFProc:exmp.:p.Here's an example of starting two instances of STAF V3 on a Unix system,specifying instance name STAF (the default) for one instance andinstance name STAF2 for another instance.  The STAF configuration fileused by each STAFProc instance specify different port numbers for eachTCP Connection Provider.:xmp.  cd /usr/local/staf  . ./STAFEnv.sh  STAFProc /usr/local/staf/bin/STAF.cfg &    . ./STAFEnv.sh STAF2  STAFProc /usr/local/staf/bin/STAF2.cfg &:exmp.:note.The STAF_INSTANCE_NAME environment variable must be set to the samevalue for a given STAFProc daemon and any applications/testcases that wantto communicate to the instance of STAF.:p.:h3 id=winvista.Running STAFProc on Windows Vista:p.On Windows Vista with UAC (User Account Controls) enabled, STAFProc is runusing the least amount of privileges (e.g. that of a standard user) even ifyou are logged in as an administrator.  If you want to run a process viathe STAF PROCESS START request that requires administrative privileges,such as an install program, and not get UAC prompts, you may need torun STAFProc as an administrator.  There are several ways to do this::ul compact.:li.Find STAFProc.exe (e.g. C:\STAF\bin\STAFProc.exe) via Windows Explorer andright mouse click on it.  To change just this one instance of starting STAFProc,select "Run as administrator".:li.Or, find STAFProc.exe (e.g. C:\STAF\bin\STAFProc.exe) via Windows Explorer andright mouse click on it.  Select "Properties" and then select the "Compatibility" tab,and check the box under "Privilege Level" labeled "Run the program as an administrator"and select OK.  Now, any time you start STAFProc it will be run as an administrator.:li.Or find "Command Prompt" and right mouse on it and select "Run as administrator".Any program such as STAFProc that is run from a "Administrator: Command Prompt", will berun as an administrator.:eul.:p.:note.When STAFProc.exe is run as an administrator, you must also run STAF.exeas an administrator if you want to submit local STAF requests from a command prompton the local Windows Vista machine.Otherwise, you'll get "Error registering with STAF, RC: 21".:p..*.*---------------------------------------------------------------------.*:i1.STAF command:ih1.commands:i2.STAF:h2 id=stafexecmd.STAF:p.STAF is an executable that is used to submit requests to STAF from thecommand line.  Please see :hdref refid=stafshs. for more informationon using the STAF command from within shell-scripts.:h4.Syntax:xmp.STAF [-verbose] <Endpoint> <Service> <Request>:exmp.:p.:ul.:li.:xph.-verbose:exph. specifies to force the use of the verbose mode forthe output.:p.:li.:xph.<Endpoint>:exph. is either LOCAL, if you wish to make a request of thelocal machine, or the name of the machine of which you wish to make a request.When making a STAF request to a remote system, in addition to specifyingthe machine name, you may also specify the network interface over whichcommunication will take place.  The format for this is: :xmp.  [<Interface>://]<System Identifier>[@<Port>]:exmp.where:  :ul compact.  :li.:xph.<Interface>:exph. is the name of the network interface.  If not specified, the default interface is used.  :li.:xph.<System Identifier>:exph. is a valid network identifier for  the interface in question.  You may specify logical or physical  identifiers.  For example, for a TCP/IP interface, the physical identifier  for a system is the IP address, while the logical identifier is the hostname.  :li.:xph.<Port>:exph. is a valid port to use for a TCP/IP interface.  If not specified, the port for the default interface is used.  One of the things this allows you to do is communicate with an instance of  STAF that is using a different TCP/IP port.  Note that the port specified  does not have to be configured on the machine submitting the request.  :eul.:p.:li.:xph.<Service>:exph. is the name of the service to which you aresubmitting a request.  Note the name of a service is case-insensitive.:p.:li.:xph.<Request>:exph. is the actual request string that you wish to submitto the service.  Note that the options for requests to STAF services arecase-insensitive.:eul.:h4.Examples:xmp.STAF local PING PINGSTAF local sem event SynchSem postSTAF testmach1 PROCESS START COMMAND notepadSTAF testmach1.company.com PROCESS LISTSTAF -verbose testmach1.company.com PROCESS LISTSTAF tcp&colon.//testmach1 TRUST LISTSTAF alt-tcp2&colon.//9.3.283.13 SERVICE LISTSTAF testmach1@6600 PROCESS START COMMAND notepad NOTIFY ONENDSTAF tcp&colon.//testmach.company.com@6500 MISC WHOAMISTAF local ECHO ECHO "Hi there"STAF 9.3.823.20 LOG MACHINE LOGNAME MyLog LEVEL info MESSAGE "This is a message"STAF local var set SYSTEM var "SomeName=Some  text  string":exmp.:h4.Notes:ol.:li.Take a closer look at the last three examples.  Quotes are required around thevalue to the echo, message, and set options because their values contains spaces.When calling STAF APIs directly from testcases/applications, you should normally use thecolon-length-colon delimited format described in :hdref refid=ovform..:li.Older versions of STAF (prior to V2.1.0) required extra effort whenquoting things on the command line.  If you should need to resort to theold command line handling algorithm, simply set the environment variableSTAF_OLDCLI to any non-empty value.:li.If running multiple instances of STAFProc, the STAF_INSTANCE_NAMEenvironment variable must be set to the instance name of the STAFProcdaemon that you want the STAF command to talk to.  For example::xmp.set STAF_INSTANCE_NAME=MySTAFstaf local ping ping:exmp.:eol.:h4.Output:p.On a successful STAF request (i.e., a request with a zero return code), theoutput from the STAF command will be as follows

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -