How to Run UFT One Tests from GitLab

by Micro Focus Employee in Application Delivery Management

Many UFT One users manage their continuous integration through GitLab. Configuring GitLab to run UFT One tests as part of a CI pipeline takes just a few simple steps. This blog post, from Dorin Bogdan and Ioana Tarau in the UFT One R&D team, explains how you can configure your GitLab instance to run UFT One tests.

Step 1: Add an SSH Key to GitLab

You will need to generate an SSH key and add it to GitLab so that it can communicate securely with your computer:

1. Open a terminal window.

2. Type ssh-keygen -t followed by the key type and an optional comment. This comment will be included in the .pub file that’s created. You may want to use an email address for the comment:

          ssh-keygen -t ed25519 -C "<comment>"

               For more information, see:  https://docs.gitlab.com/ee/ssh/

3. Go to the newly generated file (eg. C:\Users\ITarau\.ssh) and open the .pub file with notepad. Copy the content and go to GitLab.

4. Go to User Settings.

5. On the left panel click on SSH key.

6. Paste what you had copied in the Key edit box. Insert a title and click on Add key:

Step 2: Install and Configure Runners

To run pipelines in GitLab, we need runners. For installation and configuration follow the steps in this video:

https://www.youtube.com/watch?v=2MBhxk2chhM

Step 3: Run UFT tests

Before you can run the tests, you need a GitLab project that contains UFT tests, and FTToolsLauncher.exe. You can download FTToolsLauncher.exe from https://github.com/MicroFocus/ADM-FT-ToolsLauncher/releases/, by selecting the latest release. We recommend that you download version FTToolsLauncher_net48.exe.

Make sure that UFT One is installed on the machine that will run the tests (the runner machine)

Follow these steps to run the tests:

1. Open your GitLab project.

2. Go to CI/CD -> Editor.

3. Use the following script to run a test:

stages:
    - build
    - test

build:
    stage: build
    script:
        - echo "Building"
        - mkdir build
        - Set-Content -Path ./build/Props.txt -
Value "runType=FileSystem"
        - Add-Content -Path ./build/Props.txt -
Value "resultsFilename=build\\Results.xml"
        - Add-Content -Path ./build/Props.txt -Value (("Test1=$PWD" -replace '\\', '\\') + "\\UFT_Tests\\QuickPass")
        - Get-Content -Path ./build/Props.txt

    artifacts:
        paths:
            - build/
test:
    stage: test
    script:
        - echo "Testing"
        - echo $PWD
        - Test-Path "./build/Props.txt" -PathType leaf
        - Get-Content -Path ./build/Props.txt
        - Start-Process -FilePath "./FTToolsLauncher.exe" -ArgumentList "-paramfile ./build/Props.txt" -Wait *>&1
        - echo "Please check the [$PWD\build\Results.xml] file."

4. Click on commit changes

5. After running the pipeline, the UFT One test report can be found on the runner machine in the Git-Runner folder inside the UFT tests folder.

For example, C:\GitLab-Runner\builds\AsBJQfSZ\0\IoanaTarau1\my-simple-pipeline\UFT_Tests\QuickPass\Report2

Conclusion

Configuring GitLab to run UFT One tests is quite simple and consists of only a few, easy-to-follow steps.

To learn more about UFT One, visit the UFT One product page, or browse the UFT One Online Help. Click here for a free 30-day trial of UFT One.

Labels:

Functional Testing
Anonymous