Upload tests and scripts

Upload tests and scripts from other testing tools to manage them in SRF.

Tab: SCRIPTS

Before you upload

If you are uploading .js files, you can made edits to your scripts directly in SRF.

For all other test types, verify that your test includes the relevant methods and code to work as expected in SRF:

Platform scope

Uploaded web scripts can be run on all browsers, including both desktop and mobile browsers.

Uploaded mobile scripts can be run on all devices with the same operating systems, as long as the app is supported by the OS version, or other factors.

Cross-browser testing

To support full cross-browser testing, including both desktop and mobile devices, ensure that web scripts you upload do not include any mobile methods, such as to lock devices.

Use web testing methods instead.

Parameters

If you are uploading a .jar or .zip file and want to use parameters in your script, make sure you add these to your test first.

For details, see Manage your script parameters.

Back to top

Basic upload steps

Upload UFT, LeanFT, Selenium, or Appium tests to run them directly from SRF.

  1. On the SCRIPTS tab, click UPLOAD.

  2. On the left of the UPLOAD SCRIPT dialog box, drag and drop, or browse to and select the test or script you want to upload.

    UFT

    To upload UFT tests, first export them as .zip files.

    For more details, see the UFT Help Center.

    Tip: Alternately, upload your UFT tests directly from UFT. For details, see Upload UFT tests.

    LeanFT

    Upload JavaScript tests as individual .js files, or multiple files packaged in .zip files.

    Upload Java tests packaged in .jar files.

    For more details, see:

    Selenium
    Appium
  3. On the right of the UPLOAD SCRIPT dialog box:

    • Select your platform and testing tool.

    • Optionally, in the NAME field, enter a new name for your test in SRF.

Back to top

Manage your script parameters

Define parameters in your scripts to enable you to change the data used in your tests without the need for separate scripts.

Note: You can add parameters directly in SRF to scripts recorded in SRF, and uploaded .js scripts. If you are uploading a .jar or .zip file, you must add parameter names and default values to your script before you upload.

For details, see Use parameters in your scripts.

  1. On the SCRIPTS tab, hover over a script and click .

  2. On the left, under the PARAMETERS tab, enter a parameter name and value.

    Parameter names:

    • Must be unique

    • Must start with a letter (a-z), underscore (_), or dollar sign ($).

    • Cannot have spaces or special characters, except for underscores (_), or dollar signs ($).

  3. Click the checkmark that appears to the right of your parameter. Your changes are saved.

  4. Add the parameter name to your script. For details, see Use parameters in your scripts.
  5. After adding the parameter name to the code, define a default value for the script and runtime values for each automation test.

    For more details, see Script parameter runtime values.

Use parameters in your scripts

Parameters in SRF are created as environment variables.

Use the following code to read the parameter value defined in SRF:

  • Java: System.getenv(“parameterName”);
  • JavaScript: process.env.<parameterName>

Example: Perform a parameterized search

The following step includes the searchFor parameter, in JavaScript:

menusearch.click();

var searchAdvantageonlineshopping = browser.$(Web.Edit({

name: "WebEdit",

tagName: "INPUT",

type: "text"

}));

searchAdvantageonlineshopping.setValue(process.env.searchFor);

Back to top

Upload multiple scripts in zip/jar files

Package multiple scripts together as a .zip or .jar file to upload them to SRF together.

For Selenium instructions, see Prepare a Selenium .jar file for upload

JavaScript files packaged as a .zip

Add a descriptor.json file to your .zip file before uploading it to SRF.

For example:

Java tests packaged as a .jar

Package your Java tests as a .jar archive to upload to SRF. Do the following:

  1. Open or create your Java project in your IDE.

  2. Add a descriptor.json file to your test resources folder.

    Tip: The resources folder exists automatically when using LeanFT project templates. If you're are creating tests in other tools, such as Selenium, create this folder manually.

    For example:

  3. Use your IDE to export the project as an executable .jar artifact with dependencies. For details about how to do this, see the documentation for your IDE.

    Depending on the type of test you're uploading, perform additional steps before creating the JAR file.

Back to top

Edit .js scripts

On the SCRIPTS tab, hover over a .js script and click .

On the left ...
  • Edit your script tags.
  • Click PARAMETERS to add or update script parameters. For details, see Manage your script parameters.
  • Click RELATED TESTS to view a list of tests that include the current script.
On the right...
  • Edit your script code.
  • Click OPEN IN PLAYER to start running your script. For more details, see Play a specific script.

Back to top

Delete SRF assets

Hover over an asset and click .

Back to top

Play a specific script

You may want to play a specific script before adding it to your test, or afterward as maintenance.

  1. On the SCRIPTS tab, hover over your script, and click .

    Alternately, if you've clicked to edit your script, click OPEN IN PLAYER at the top right.

  2. When the script opens, and before you play it:

    • Select / change your environment. In the popup, click EDIT.

      For example:

    • View / modify script details and parameters. On the left, click INFO.

  3. Then, use the toolbar to run and stop your script, show or hide the code, and so on.

  4. After playing your script, click STEPS on the left to show results for each step in your script.

Note: If you've uploaded a .zip file with multiple scripts, only the first script is played.

Back to top

See also: