IBM Support

Using a zip file to export and import a script

Troubleshooting


Problem

Scripts could easily be exported from one IBM Rational RobotJ datastore into a zip file and then imported into another datastore. If the same method is used in IBM Rational(R) XDE Tester, several compilation errors can occur in the imported script: The declared package does not match the expected package The import resources.ScriptName cannot be resolved ScriptNameHelper cannot be resolved or is not a valid superclass The method MethodName is undefined for the type ScriptName

Cause

The export utility zips-up the script in a folder with the same name as the 'source' datastore. When the zip file is imported into the 'target' datastore, a subfolder is created in the 'target' datastore with the same name as the 'source' datastore, and the script is placed into that subfolder. This breaks the internal references in the script to other script files.

Resolving The Problem

Ordinarily, the user should try to copy a script to a different datastore via the Java perspective rather than using a zip file (click on the link below to find out how to copy scripts via the Java perspective). If using the Java perspective is not feasible (for example, if the user is copying a script from a datastore that is local to one computer to a datastore on another computer), it is still possible to use a zip file to export and import a script; However, the zip file must be manually edited.

Method One: Exporting the zip file via XDE Tester

Part I: Create the zip file

Exporting a script to a zip file is the same in XDE Tester as it was in RobotJ:

  1. Select File > Export from XDE Tester's menu
  2. Select Zip file and click Next
  3. Click Deselect All to make sure nothing is accidentally selected
  4. On the left-hand side, highlight the datastore in which the script is located (do not check the checkbox for the datastore, just click on it so that the datastore name is highlighted)
    1. On the right-hand side, select the "ScriptName.java" file by selecting the checkbox next to it
    2. If the script uses a shared map, select the "SharedMapName.rftmap" file by selecting the checkbox next to it
  5. On the left-hand side, expand the datastore and highlight the resources subfolder
    1. On the right-hand size, select the "ScriptHelperName.java" and "ScriptName.rftdef" files by selecting the checkboxes next to them
    2. If the script has any verification points, select the "ScriptName.VPName.base.rftvp" file for each verification point
    3. If the script uses a private object map, select the "ScriptName.rftxmap" file
  6. Type a directory path and name for the zip file (or browse to it)
  7. Under Options, make sure that "Create directory structures for files" is selected and Click Finish

Part II: Extract the zip file and create a new zip file

Extract the contents of the zip file into a temporary folder, which now contains a subdirectory with the same name as the 'source' datastore. That subdirectory contains:

  • A ScriptName.java file
  • An ObjectMapName.rftmap file (if the script uses a shared map)
  • A subdirectory named 'resource' which contains
    • A ScriptNameHelper.java file
    • A ScriptName.rftdef file
    • A ScriptName.rftxmap file (if the script uses a private object map)
    • A ScriptName.VPName.base.rftvp file for each verification point if the script (if any)
Once the files have been extracted:
  1. Zip-up the resources subdirectory so that the resources directory is included in the zip file (do any zip-up the entire path on the local computer to the resources directory, just zip-up the resources directory itself.
  2. Add the ScriptName.java file to the new zip file (and the ObjectMapName.rftmap file if one exists). Do not zip-up these files with any directory or path information.
  3. (Optional) Rename the new zip file if it was named resources.zip when created

but do not zip it up within the resources folder; the ScriptName.java file should be added to the new zip file without any directory information (also a

Part III: Import the new zip file

Once the new zip file is created:

  1. Select File > Import from XDE Tester's menu
  2. Select Zip file and click Next
  3. Click the Browse button next to the 'From zip file' field and browse to the location of the new zip file created in Part II
  4. Click the Browse button next to the 'Into folder' field, select the desired datastore and click OK
  5. Click Finish

The script should now appear in the datastore explorer window underneath the main datastore folder

Method Two: Create the zip file outside of XDE Tester

Instead of creating the zip file via XDE Tester, create the zip file manually:

  1. Create a temporary folder and in that folder create a temporary folder called resources
  2. Using Windows Explorer
    1. Copy the ScriptName.java file from the 'Source' datastore to the temporary folder (and the ObjectMapName.rftmap if the script uses a shared object map)
    2. Copy the following files from the datastore\resources folder to the temporary\resources folder
      1. ScriptNameHelper.java
      2. ScriptName.rftdef
      3. ScriptName.rftxmap (if the script uses a private object map)
      4. ScriptName.VPName.base.rftvp for the verification points
  3. Create the zip file in the same manner as in Part II of the first method
  4. Import the zip file in the same manner as in Part III of the first method



[{"Product":{"code":"SSSHZT","label":"Rational XDE Tester"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"--","Platform":[{"code":"PF033","label":"Windows"}],"Version":"2003;2003.06.00;2003.06.01;2003.06.12;2003.06.13","Edition":"","Line of Business":{"code":"","label":""}}]

Document Information

Modified date:
16 June 2018

UID

swg21192655