Aller au contenu

UFT

Note

This plugin is available only in the Ultimate version of Squash.

This plugin provides functions that handle UFT tests. It has been validated with UFT 15.0.2 and should work with any recent version of UFT.

Warning

Squash current version only supports "GUI Testing". "API Testing" and "BPT Testing" are not available yet.

It can be used directly in a workflow, or indirectly via generators (such as those providing access to test case managers).

A working UFT installation must be available in the targeted execution environments.

The functions have a uft category prefix.

Functions

uft/uft@v1

Run a UFT test folder.

If the function is used more than once in a job, it is up to the caller to ensure no previous test execution results remain before executing a new test.

Test parameters are optional but if used they must be declared in the test run.

Inputs

The function has the following inputs:

  • datasource (required)

    The test folder to use.

  • test_parameters (optional)

    External parameters to use.

Reports

The function generates the following reports:

  • uft-results.xml

    Run results XML file.

    The run results XML file has the application/vnd.opentestfactory.uft-report+xml content type.

  • uft-report.tar

    A TAR archive.
    Contains all files present in the Res1 results folder.

Example

- uses: uft/uft@v1
  with:
    datasource: uftSolution/uftTestFolder
    test_parameters:
      param1: value
      param2: value

uft/execute@v1

An 'execute' function for use by generators.

Test Reference format

The test reference format used by uft/execute@v1 is as follows:

  • {testfolder}

With:

  • {testfolder}: The path to the test folder to execute.

Inputs

The function has the following inputs:

  • test (required)

    The test reference.

Reports

The function generates the following reports:

  • uft-results.xml

    Run results XML file.

    The run results XML file has the application/vnd.opentestfactory.uft-report+xml content type.

  • uft-report.tar

    A TAR archive.
    Contains all files present in the Res1 results folder.

Example

- uses: uft/execute@v1
  with:
    test: uftSolution/uftTestFolder

uft/params@v1

A 'params' function for use by generators.

Inputs

The function has the following inputs:

  • data (required)

    The data to use for the automated test.

  • format (required)

    The format to use for the automated test data.

Example

- uses: uft/params@v1
  with:
    data:
      global:
        key1: value1
        key2: value2
      test:
        key1: value3
        key3: value4
    format: format

format must so far be SQUASHTM_FORMAT (tm.squashtest.org/params@v1).

data can have two keys:

  • global for defining global parameters.
  • test for defining test parameters.

Using with inception

Please refer to "Inception" for more information on what is inception.

Preload the inception environment with at least the tests execution report data.

Example

my_workflow.yaml
metadata:
  name: UFT Inception
resources:
  files:
  - report1
jobs:
  my_specific_job:
    runs-on: inception
    - uses: actions/prepare-inception@v1
      with:
        uft-results.xml: ${{ resources.files.report1 }}
    - uses: uft/execute@v1
      with:
        test: uftSolution/uftTestFolder

You can use the following command to run it:

opentf-ctl \
    run workflow my_workflow.yaml \
    -f report1=output_1.xml
opentf-ctl ^
    run workflow my_workflow.yaml ^
    -f report1=output_1.xml
opentf-ctl `
    run workflow my_workflow.yaml `
    -f report1=output_1.xml

Configuration

Hooks can be defined for the provided functions. This can be done in workflow definitions or at the orchestrator level so that they apply to all your workflows.

Configuration at the orchestrator level is done by setting the UFT_PROVIDER_HOOKS environment variable or by adding the hook definitions in the /app/conf/uft.yaml service configuration file.

Please refer to "Hooks for plugin providers" in OpenTestFactory documentation for more information.