Transfer folders/files between machines with STAF

Here is the scenario: Two machines, machineA and machineB.

1. Transfer c:test folder from machineA to c:test1 folder on machineB, by sending command from machineA

staf local fs copy directory c:test todirectory c:test1 tomachine machineB recurse

2. Transfer c:test folder from machineA to c:test1 folder on machineB, by sending command from machineB

staf tcp://machineA fs copy directory c:test todirectory c:test1 recurse

NOTE: file copy is the same except for the file copy option.


Invoke command with quote from staf process service

As we know, the command invoked from staf process service is wrapped by quote, what if the command itself has quote?

Just like what we do in java code, use ”" to escape, here is a sample to stop a remote vmware:

   1: staf tcp://remote_machine process start command "vmrun stop "c:vm_uep_installwin2003_standardwindows server 2003 standard edition.vmx"" wait returnstdout stderrtostdout

Run RFT script from command line

Format:

java -classpath <…> com.rational.test.ft.rational_ft -datastore <…> -log <…> -playback <…>

Three things need to be highlighted to go through this task.

1. The rational_ft.jar must be provided in the -classpath.

2. The -datastore and -log is not optional, RFT will throw a NullPointerException if any of these option is not provided.

3. The path of the script class must be provided in the -classpath, so as to the associated resources path.

4. The log path is only a name of the folder relative to the ${workspace}/_logs/.

5. The datastore path must be the absolute path.

6. The script name could be only the name of the script class file, not the complete path, if it reside in the path specified to the -classpath.

And at last,  a working example to help better understand the command line interface.

C:>java -cp "C:Documents and SettingsdongxuIBMrationalsdp7.0workspaceUEPInstall";"C:Documents and SettingsdongxuIBMrationalsdp7.0workspaceUEPInstallresources";"E:IBMSDP70FunctionalTesterbinrational_ft.jar" com.rational.test.ft.rational_ft -datastore "C:Documents and SettingsdongxuIBMrationalsdp7.0workspaceUEPInstall\" -log test2log -playback Script2

 

The complete command line for invoking from remote staf client is terrible:

C:>staf tcp://uep-install process start shell command "java -cp "C:Documents and SettingsdongxuIBMrationalsdp7.0workspaceUEPInstall";"C:Documents and SettingsdongxuIBMrationalsdp7.0workspaceUEPInstallresources";"E:IBMSDP70FunctionalTesterbinrational_ft.jar" com.rational.test.ft.rational_ft -datastore "C:Documents and SettingsdongxuIBMrationalsdp7.0workspaceUEPInstall\\" -log test2log -playback Script2" wait returnstdout stderrtostdout
Response
——–
{
  Return Code: 0
  Key        : <None>
  Files      : [
    {
      Return Code: 0
      Data       : hello, world

    }
  ]

Updated:

Command line interface is a bit different for RFT6:

java -Drational_ft.install.dir="d:Program FilesIBMRationalSDP6.0FunctionalTestereclipsepluginscom.rational.test.ft.wswplugin_6.1.0" -cp "d:Program FilesIBMRationalSDP6.0FunctionalTestereclipsepluginscom.rational.test.ft.wswplugin_6.1.0rational_ft.jar" com.rational.test.ft.rational_ft -datastore c:staf_wsp1 -log Script1 -playback Script1